summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl2: Remove the shader_in/shader_out tracking separate from var->mode.Eric Anholt2010-08-041-4/+0
| | | | | | | | | | | | | | | 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.
* glsl2: Add ir_assignment::write_mask and associated methodsIan Romanick2010-08-041-2/+111
| | | | | | | | | | | | | | | | | | | | | | | 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.
* glsl2: Initialize the ARB_fcc fields of ir_variable.Eric Anholt2010-08-021-0/+2
| | | | Fixes intermittent failure in glsl-arb-fragment-coord-conventions.
* glsl2: Initialize ir_function_signature::is_built_in.Kenneth Graunke2010-07-301-0/+1
| | | | Fixes a valgrind error.
* glsl2: Fix spelling of "sentinel."Eric Anholt2010-07-291-4/+4
|
* glsl2: Add new ir_constant::zero static method.Kenneth Graunke2010-07-281-0/+12
| | | | This conveniently creates a zero value of whatever type you want.
* glsl2: When stealing var->constant_value, steal its children as well.Eric Anholt2010-07-271-1/+1
| | | | | Fixes: glsl1-GLSL 1.20 uniform array constructor
* glsl2: Also steal the constant components of aggregate-typed ir_constants.Eric Anholt2010-07-261-0/+18
|
* glsl2: Steal ir_variable's constant_value field.Kenneth Graunke2010-07-261-0/+3
| | | | Fixes a link-time crash in glsl-vs-cross-3.
* glsl2: Initialize ir_instruction::type and ir_rvalue::type.Kenneth Graunke2010-07-221-0/+5
| | | | | | | | | | | 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.
* ir_constant_expression: Add support for array == and !=.Kenneth Graunke2010-07-211-3/+8
| | | | | Piglit parser tests const-array-03.frag and const-array-04.frag now generate the correct code.
* glsl2: Extend ir_constant to store constant arrays, and generate them.Kenneth Graunke2010-07-211-2/+21
| | | | | | | | | 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.
* glsl2: Implement utility routine to talloc reparent an IR treeIan Romanick2010-07-201-0/+15
|
* glsl2: Add and use new variable mode ir_var_temporaryIan Romanick2010-07-201-2/+4
| | | | | | | | | | | | | | | | | 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'.
* glsl2: strdup the field names used in dereference_record.Eric Anholt2010-07-201-2/+2
| | | | | Otherwise, after linking and freeing the old data, the pointer would dangle. Partial fix for glsl1-struct*.
* glsl2: Give IR nodes a type field.Eric Anholt2010-07-191-2/+21
| | | | | | | 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.
* glsl2: Remove the const disease from function signature's callee.Eric Anholt2010-07-181-1/+1
|
* glsl2: Make cross() be an expression operation.Eric Anholt2010-07-181-0/+2
| | | | | | 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.
* ir_function_signature: Add method to get the function owning a signatureIan Romanick2010-07-121-1/+1
| | | | | | | | | 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.
* ir_call: Add method to set the function signature being calledIan Romanick2010-07-121-0/+8
|
* glsl2: Add ir_unop_fract as an expression type.Eric Anholt2010-07-011-0/+2
| | | | | Most backends will prefer seeing this to seeing (a - floor(a)), so represent it explicitly.
* glsl2: Make function names and variable names be children of the node.Eric Anholt2010-06-301-3/+2
| | | | This avoids losing their memory when the parser state is freed.
* ir_swizzle: Add new constructor, refactor constructorsIan Romanick2010-06-291-18/+45
| | | | | Adds a new constructor that takes an array of component values. Refactors the meat of the two constructors to an init_mask method.
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-241-0/+818