Commit Graph

20 Commits

Author SHA1 Message Date
Kenneth Graunke 46d91615a2 ast_function: Set constant_value on return value temporaries in 1.20+. 2010-07-28 15:46:26 -07:00
Kenneth Graunke 74e1802f5d 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.
2010-07-21 16:38:33 -07:00
Kenneth Graunke 13a19745d4 glsl2: Emit array constructors inline. 2010-07-21 16:38:32 -07:00
Kenneth Graunke 0048c7aef8 glsl2: Add some comments. 2010-07-21 16:37:57 -07:00
Kenneth Graunke c7a18da690 glsl2: Replace insert_before/remove pairs with exec_node::replace_with. 2010-07-21 16:37:57 -07:00
Ian Romanick f38d15b80d glsl2: glsl_type has its own talloc context, don't pass one in 2010-07-20 17:48:25 -07:00
Ian Romanick 7e2aa91507 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'.
2010-07-20 17:48:24 -07:00
Eric Anholt 02d3711a21 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.
2010-07-20 15:59:04 -07:00
Eric Anholt 1f47245bdd glsl2: Remove the const disease from function signature's callee. 2010-07-18 18:13:06 -07:00
Kenneth Graunke 17a307d154 ast_function: Actually do type conversion on function arguments. 2010-07-14 16:49:24 -07:00
Kenneth Graunke 284d821206 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.
2010-07-09 09:46:29 -07:00
Kenneth Graunke f58bbd134e ast_function: Move error return earlier and don't indent the world.
This has no functional changes.
2010-07-09 09:46:29 -07:00
Kenneth Graunke 59df3385e1 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.
2010-07-09 09:46:29 -07:00
Kenneth Graunke 953ff1283d 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.
2010-06-30 13:52:24 -07:00
Ian Romanick 4b6feb0398 glsl2: Use talloc_strdup when generating constructor temporary names 2010-06-29 11:15:26 -07:00
Ian Romanick 699b247661 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.
2010-06-29 11:15:26 -07:00
Ian Romanick 81c7e94466 glsl2: Always emit matrix constructors inline 2010-06-29 11:15:26 -07:00
Ian Romanick c31dcdf57e glsl2: Always emit vector constructors inline 2010-06-29 11:15:26 -07:00
Ian Romanick 26b5d33dce glsl2: Use i2b and f2b IR opcodes for casting int or float to bool 2010-06-28 10:04:18 -07:00
Eric Anholt 2928588267 glsl2: Move the compiler to the subdirectory it will live in in Mesa. 2010-06-24 15:36:00 -07:00
Renamed from ast_function.cpp (Browse further)