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
Ian Romanick
13f782c4ae
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.
2010-07-12 18:51:55 -07:00
Ian Romanick
e2e5d0def4
linker: Refactor cross_validate_uniforms into cross_validate_globals
...
The later, more generic function will be used in the intra-stage linker.
2010-07-12 18:51:55 -07:00
Eric Anholt
d74c9ff046
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.
2010-07-12 16:07:02 -07:00
Eric Anholt
7b96b474e0
glsl2: Add support for variable vector indexing on the LHS of assignments.
...
Fixes glsl-vs-vec4-indexing-3.
2010-07-12 16:07:02 -07:00
Eric Anholt
b87259d3ef
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.
2010-07-12 16:07:02 -07:00
Eric Anholt
8258a6a2c3
ir_to_mesa: Add support for dereferencing matrices from arrays.
2010-07-12 16:07:02 -07:00
Ian Romanick
506880bc32
ir_validate: Also perform usual checks on ir_dereference_variable nodes
2010-07-12 15:46:16 -07:00
Ian Romanick
8baf21b1a4
ir_validate: Validate that varibles are declared before used in IR
2010-07-12 15:43:50 -07:00
Ian Romanick
3fb878722e
linker: Stub-out intrastage linker
2010-07-12 15:19:30 -07:00