aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_to_hir.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Make the symbol table's add_variable just use the variable's name.Eric Anholt2010-11-291-2/+2
|
* glsl: Make the symbol table's add_function just use the function's name.Eric Anholt2010-11-291-1/+1
|
* glsl: Fix erroneous cast in ast_jump_statement::hir()Chad Versace2010-11-171-2/+1
| | | | | | Return values were erroneously cast from (ir_rvalue*) to (ir_expression*). NOTE: This is a candidate for the 7.9 branch.
* glsl: Fix ast-to-hir for ARB_fragment_coord_conventionsChad Versace2010-10-251-1/+1
| | | | | | | | | | | Function ast_declarator_list::hir(), when processing keywords added by extension ARB_fragment_coord_conventions, made the mistake of checking only if the extension was __supported by the driver__. The correct behavior is to check if the extensi0n is __enabled in the parse state__. NOTE: this is a candidate for the 7.9 branch. Reviewed-by: Ian Romanick <[email protected]>
* glsl: Remove useless ir_shader enumeration value.Kenneth Graunke2010-10-201-5/+1
|
* glsl: Add assert for unhandled ir_shader case.Vinson Lee2010-10-201-0/+4
| | | | | | | | Silences this GCC warning. ast_to_hir.cpp: In function 'void apply_type_qualifier_to_variable(const ast_type_qualifier*, ir_variable*, _mesa_glsl_parse_state*, YYLTYPE*)' ast_to_hir.cpp:1768: warning: enumeration value 'ir_shader' not handled in switch
* glsl: Implement ast-to-hir for bit-logic opsChad Versace2010-10-191-4/+12
| | | | | | | Implement by adding to ast_expression::hir() the following cases: - ast_and_assign - ast_or_assign - ast_xor_assign
* glsl: Define bit_logic_result_type() in ast_to_hir.cppChad Versace2010-10-191-32/+67
| | | | | | | | | This function type checks the operands of and returns the result type of bit-logic operations. It replaces the type checking performed in the following cases of ast_expression::hir() : - ast_bit_and - ast_bit_or - ast_bit_xor
* glsl: Implement ast-to-hir for bit-shift-assignmentChad Versace2010-10-191-4/+12
| | | | | | Implement by adding to ast_expression::hir() these cases: - ast_ls_assign - ast_rs_assign
* glsl: Define shift_result_type() in ast_to_hir.cppChad Versace2010-10-191-41/+67
| | | | | | | | This function type checks the operands of and returns the result type of bit-shift operations. It replaces the type checking performed in the following cases of ast_expression::hir() : - ast_lshift - ast_rshift
* glsl: Don't return NULL IR for erroneous bit-shift operators.Kenneth Graunke2010-10-181-5/+0
| | | | | | | | Existing code relies on IR being generated (possibly with error type) rather than returning NULL. So, don't break - go ahead and generate the operation. As long as an error is flagged, things will work out. Fixes fd.o bug #30914.
* glsl: Implement ast-to-hir for binary shifts in GLSL 1.30Chad Versace2010-10-151-3/+58
| | | | | | | | | | Implement by adding the following cases to ast_expression::hir(): - ast_lshift - ast_rshift Also, implement ir validation for the new operators by adding the following cases to ir_validate::visit_leave(): - ir_binop_lshift - ir_binop_rshift
* glsl: Add linker support for explicit attribute locationsIan Romanick2010-10-081-3/+15
|
* glsl: Track explicit location in AST to IR translationIan Romanick2010-10-081-0/+47
|
* glsl: Wrap ast_type_qualifier contents in a struct in a unionIan Romanick2010-10-081-30/+33
| | | | This will ease adding non-bit fields in the near future.
* glsl: Properly handle nested structure types.Kenneth Graunke2010-09-181-25/+6
| | | | Fixes piglit test CorrectFull.frag.
* glsl: Change from has_builtin_signature to has_user_signature.Kenneth Graunke2010-09-161-1/+1
| | | | | The print visitor needs this, and the only existing user can work with has_user_signature just as well.
* glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmpsLuca Barbieri2010-09-131-2/+2
| | | | | | | | | | | | | | | | | Currently GLSL IR forbids any vector comparisons, and defines "ir_binop_equal" and "ir_binop_nequal" to compare all elements and give a single bool. This is highly unintuitive and prevents generation of optimal Mesa IR. Hence, first rename "ir_binop_equal" to "ir_binop_all_equal" and "ir_binop_nequal" to "ir_binop_any_nequal". Second, readd "ir_binop_equal" and "ir_binop_nequal" with the same semantics as less, lequal, etc. Third, allow all comparisons to acts on vectors. Signed-off-by: Ian Romanick <[email protected]>
* ast_to_hir: Mark arrays as lvalues in GLSL ES, but prohibit assignment.Kenneth Graunke2010-09-071-1/+7
| | | | | | This allows them to be passed as out/inout parameters, but still prevents them from being used as the target of an assignment. This is per section 5.8 of the GLSL ES 1.00 specification.
* glsl: Allow overloading of built-ins without hiding in GLSL ES.Kenneth Graunke2010-09-071-1/+1
| | | | The rules are explicitly different from desktop GLSL.
* glsl: Move is_builtin flag back to ir_function_signature.Kenneth Graunke2010-09-071-1/+1
| | | | | | | | | | | This effectively reverts b6f15869b324ae64a00d0fe46fa3c8c62c1edb6c. In desktop GLSL, defining a function with the same name as a built-in hides that built-in function completely, so there would never be built-in and user function signatures in the same ir_function. However, in GLSL ES, overloading built-ins is allowed, and does not hide the built-in signatures - so we're back to needing this.
* ast_to_hir: Reject embedded structure definitions in GLSL ES 1.00.Kenneth Graunke2010-09-071-0/+9
|
* ast_to_hir: Reject unsized array declarations in GLSL ES 1.00.Kenneth Graunke2010-09-071-9/+18
|
* glsl: Set default language version in mesa_glsl_parse_state constructor.Kenneth Graunke2010-09-071-0/+2
| | | | | | | | | | This should make it easier to change the default version based on the API (say, version 1.00 for OpenGL ES). Also, synchronize the symbol table's version with the parse state's version just before doing AST-to-HIR. This way, it will be set when it matters, but the main initialization code doesn't have to care about the symbol table.
* glsl2: Forbid array-types in ?: operator in GLSL 1.10Ian Romanick2010-09-071-0/+11
| | | | Fixes bugzilla #30039.
* glsl: Apply implicit conversions to structure constructor parameters.Kenneth Graunke2010-09-011-1/+1
| | | | | | | The code for handling implicit conversions should probably get refactored, but for now, this is easy. Fixes piglit test constructor-26.vert.
* glsl2: Remove unnecessary glsl_symbol_table::get_function parameter ↵Ian Romanick2010-09-011-1/+1
| | | | | | | | 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.
* glsl2: Don't generate constructor functions for structuresIan Romanick2010-09-011-2/+1
|
* glsl2: Disallow function declarations within function definitions in GLSL 1.20Ian Romanick2010-09-011-1/+36
| | | | | | | 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.
* ast_to_hir: Add support for bit-wise operators (but not shifts).Kenneth Graunke2010-08-311-2/+53
| | | | | | | 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.
* glsl2: Remove a couple FINISHME comments that have already been resolvedIan Romanick2010-08-261-7/+1
|
* glsl: Move built-ins to live beyond the global scope.Kenneth Graunke2010-08-261-4/+20
| | | | | | | | | | 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.
* glsl: Refactor variable declaration handling.Kenneth Graunke2010-08-261-36/+41
| | | | | | | | | | | | | 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 <[email protected]>
* glsl: Don't add overloads to existing structure constructors.Kenneth Graunke2010-08-261-1/+1
| | | | | | Instead, make a new ir_function and try to add it to the symbol table. Fixes piglit test redeclaration-08.vert.
* glsl: Remove name_declared_this_scope check when adding functions.Kenneth Graunke2010-08-261-9/+8
| | | | | | Instead, rely on the symbol table's rules. Fixes redeclaration-02.vert.
* glsl: Use a single shared namespace in the symbol table.Kenneth Graunke2010-08-261-10/+2
| | | | | | | | | | | | 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.
* glsl: fix crash with variable indexing into array in a structAras Pranckevicius2010-08-251-1/+7
| | | | Signed-off-by: Ian Romanick <[email protected]>
* glsl: Include main/core.h.Chia-I Wu2010-08-241-2/+1
| | | | Make glsl include only main/core.h from core mesa.
* glsl: When unable to assign the initializer for a const variable, set it to 0.Eric Anholt2010-08-231-13/+21
| | | | | | | 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
* glsl: Cleanly fail when a function has an unknown return type.Eric Anholt2010-08-231-1/+7
| | | | Bug #29608.
* glsl: Trim the size of uniform arrays to the maximum element used.Eric Anholt2010-08-231-0/+5
| | | | Fixes glsl-getactiveuniform-array-size.
* glsl: Silence unused variable warning.Vinson Lee2010-08-211-0/+1
| | | | The variable is actually used but only in the body of an assert.
* glsl: Handle array declarations in function parameters.Kenneth Graunke2010-08-211-4/+13
| | | | | | | | | 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).
* ast_to_hir: Reject function names that start with "gl_".Kenneth Graunke2010-08-201-0/+12
| | | | Fixes piglit test redeclaration-03.vert.
* ast_to_hir: Fix crash when a function shadows a variable.Kenneth Graunke2010-08-201-2/+3
| | | | | | | | 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).
* glsl: Fix scoping bug in if statements.Kenneth Graunke2010-08-181-2/+8
| | | | | Fixes glslparsertest/glsl2/scoping-01.frag (successfully compiled but should've failed) and scoping-02.frag (assertion triggered).
* glsl2: Remove unnecessary use of 'struct' before type namesIan Romanick2010-08-131-5/+5
| | | | | | | | 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.
* glsl2: Don't declare a variable called sig that shadows the other oneIan Romanick2010-08-111-1/+1
| | | | | | | | | 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).
* glsl2: Insert global declarations at the top of the instruction stream.Eric Anholt2010-08-051-1/+8
| | | | | | | | Fixes use-before-decl in glslparsertest shaders. Fixes: CorrectFull.frag CorrectModule.frag
* glsl2: Remove the shader_in/shader_out tracking separate from var->mode.Eric Anholt2010-08-041-27/+10
| | | | | | | | | | | | | | | 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.