Ian Romanick
de415b7f4b
linker: Add comment about bug in initializer handling
2010-07-19 14:50:43 -07:00
Ian Romanick
8fe8a814b0
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.
2010-07-19 14:50:43 -07:00
Ian Romanick
a48a2b66e8
ir_function_signature: Make actual_parameters public
2010-07-19 14:50:43 -07:00
Ian Romanick
3880d07f4b
linker: Remove some unnecessary includes
2010-07-19 14:50:43 -07:00
Kenneth Graunke
61a44ccaef
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.
2010-07-19 14:49:34 -07:00
Ian Romanick
303c99f12f
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.
2010-07-19 12:36:32 -07:00
Ian Romanick
9303e358cb
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.
2010-07-19 12:36:32 -07:00
Eric Anholt
5304493c40
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.
2010-07-19 11:58:03 -07:00
Eric Anholt
82d4b9593b
glsl2: Fix the expression type for atan's pi * sign(y).
...
Fixes CorrectFunction.vert.
2010-07-19 10:47:12 -07:00
Eric Anholt
95c08920ea
i915: Ask the compiler to flatten out all the if statements that it can.
2010-07-19 10:47:08 -07:00
Eric Anholt
29ce44ad2b
glsl2: Add a pass for converting if statements to conditional assignment.
...
This will be used on 915 and similar hardware of that generation.
2010-07-19 10:21:38 -07:00
Eric Anholt
d16044ad4d
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.
2010-07-19 09:50:29 -07:00
Eric Anholt
ee7b2b3f44
ir_to_mesa: Do validation on the IR tree.
2010-07-19 09:50:26 -07:00
Eric Anholt
4802fd905a
ir_to_mesa: Don't do lowering passes on an errored-out shader.
2010-07-19 09:44:30 -07:00
Eric Anholt
b29d31cd67
ir_to_mesa: Rename struct temp_entry, which is used for all variables now.
2010-07-18 18:13:07 -07:00
Eric Anholt
7b13014942
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.
2010-07-18 18:13:06 -07:00
Eric Anholt
1f47245bdd
glsl2: Remove the const disease from function signature's callee.
2010-07-18 18:13:06 -07:00
Eric Anholt
9be7f63813
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.
2010-07-18 18:12:12 -07:00
Eric Anholt
87a2ee8db6
glsl2: Fix warning from always-false assert not being known to not return.
2010-07-18 17:49:15 -07:00
Kenneth Graunke
17a307d154
ast_function: Actually do type conversion on function arguments.
2010-07-14 16:49:24 -07:00
Kenneth Graunke
1fdcdb2dca
exec_list: Add a new replace_with method.
2010-07-14 16:49:24 -07:00
Kenneth Graunke
53120805a8
Refresh autogenerated file builtin_function.cpp.
2010-07-14 16:49:24 -07:00
Kenneth Graunke
d5316aeb38
glsl2/builtins: Rework clamp to use scalar/vector combinations.
2010-07-14 16:49:24 -07:00
Kenneth Graunke
8984203abb
glsl2/builtins: Rework min/max to use scalar/vector combinations.
2010-07-14 16:49:24 -07:00
Kenneth Graunke
ce5ae5f49d
ir_constant_expression: Add support for ir_binop_mod.
2010-07-14 16:49:24 -07:00
Kenneth Graunke
79fed377f4
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))
2010-07-14 15:50:28 -07:00
Kenneth Graunke
891a0647e4
ir_constant_expression: Add support for ir_binop_pow.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
3fab376bef
ir_constant_expression: Add support for ir_unop_cos.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
908afd16d1
ir_constant_expression: Add support for ir_unop_sin.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
074720477c
ir_constant_expression: Add support for ir_unop_floor.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
c1ee30a145
ir_constant_expression: Add support for ir_unop_ceil.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
323d909ab2
ir_constant_expression: Add support for ir_unop_trunc.
...
This uses a C99 function.
2010-07-14 15:50:28 -07:00
Kenneth Graunke
cb63929df4
ir_constant_expression: Add support for ir_unop_log2.
...
This uses a C99 function.
2010-07-14 15:50:27 -07:00
Kenneth Graunke
aca01edc83
ir_constant_expression: Add support for ir_unop_exp2.
...
This uses a C99 function.
2010-07-14 15:50:27 -07:00
Kenneth Graunke
14b7b2660c
ir_constant_expression: Add support for ir_unop_sign.
2010-07-14 15:50:27 -07:00
Kenneth Graunke
5e840dba44
ir_constant_expression: Remove bogus assert in ir_unop_abs case.
...
abs is defined for integral types; it's even implemented.
2010-07-14 15:50:27 -07:00
Kenneth Graunke
7d19bf2ec3
glsl2: Remove ir_program bong hits.
2010-07-14 15:50:27 -07:00
Eric Anholt
021222c6a8
ir_to_mesa: Add convenience function for opcodes with no src/dst reg.
...
Most of flow control is like this.
2010-07-13 12:24:39 -07:00
Eric Anholt
c10a68522c
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).
2010-07-13 11:07:16 -07:00
Eric Anholt
4d5da50b94
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.
2010-07-13 09:52:20 -07:00
Eric Anholt
f8a2b65bc9
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.
2010-07-13 09:52:20 -07:00
Ian Romanick
4e6a3e0d2d
glsl2: Remove unnecessary casts of clone return values
2010-07-13 09:22:35 -07:00
Eric Anholt
4ca07882af
ir_to_mesa: Rely on ir_mat_op_to_vec for matrix multiplication support.
2010-07-12 19:50:49 -07:00
Eric Anholt
15ded63279
glsl2: Add matrix multiplication to ir_mat_op_to_vec.
2010-07-12 19:50:49 -07:00
Eric Anholt
3f08989267
ir_to_mesa: Emit OPCODE_MAD when we find an ADD of a MUL.
...
Bug #27914 .
2010-07-12 19:50:49 -07:00
Eric Anholt
562c3d0cb1
glsl2: Flatten expression that appear as the parameters of ir_call as well.
2010-07-12 19:50:49 -07:00
Eric Anholt
94da2abfd4
glsl2: Flatten expressions that appear as the children of ir_return as well.
2010-07-12 19:50:49 -07:00
Ian Romanick
31a97868fc
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.
2010-07-12 19:12:28 -07:00
Ian Romanick
15ce87e9f2
linker: Detect the shader that contains "main" during intrastage linking
2010-07-12 18:51:55 -07:00
Ian Romanick
11fc7beb2f
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.
2010-07-12 18:51:55 -07:00