Commit graph

70 commits

Author SHA1 Message Date
Kenneth Graunke
c5a27b5939 glsl: Change texel offsets to a single vector rvalue.
Having these as actual integer values makes it difficult to implement
the texture*Offset built-in functions, since the offset is actually a
function parameter (which doesn't have a constant value).

The original rationale was that some hardware needs these offset baked
into the instruction opcode.  However, at least i965 should be able to
support non-constant offsets.  Others should be able to rely on inlining
and constant propagation.
2011-01-31 11:10:59 -08:00
Kenneth Graunke
60c8e91c79 glsl: Re-synchronize ir_variable_mode and the printer's string array.
Since the introduction of ir_var_system_value, system variables would be
printed as "temporary" and temporaries would result in out-of-bounds
array access, showing up as garbage in printed IR.
2011-01-31 11:04:37 -08:00
Kenneth Graunke
bbafd2b849 ir_reader: Make assignment conditions optional.
You can now simply write (assign (xy) <lhs> <rhs>) instead of the
verbose (assign (constant bool (1)) (xy) <lhs> <rhs>).
2011-01-12 23:55:34 -08:00
Kenneth Graunke
b7acf538af ir_print_visitor: Print out constant structure values.
In the form (constant type ((field1 value) (field2 value) ...))
2010-12-03 13:59:21 -08:00
Kenneth Graunke
ff994eeff8 glsl: Remove anti-built-in hacks from the print visitor.
Now that we only import built-in signatures that are actually used,
printing them is reasonable.
2010-11-30 13:48:28 -08:00
Ian Romanick
fc92e87b97 glsl: Eliminate assumptions about size of ir_expression::operands
This may grow in the near future.
2010-11-19 15:00:25 -08:00
Kenneth Graunke
8fbe968a62 glsl: Don't print blank (function ...) headers for built-ins.
Fixes a regression caused when I added my GLSL ES support.
2010-09-16 03:09:25 -07:00
Kenneth Graunke
f412fac5b4 glsl: Move is_builtin flag back to ir_function_signature.
This effectively reverts b6f15869b3.

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.
2010-09-07 17:30:38 -07:00
Ian Romanick
9710d272f7 ir_print_visitor: Print empty else blocks more compactly 2010-09-03 11:55:21 -07:00
Kenneth Graunke
b6f15869b3 glsl: Move is_built_in flag from ir_function_signature to ir_function.
Also rename it to "is_builtin" for consistency.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-08-26 09:19:48 -07:00
Brian Paul
d3b66be3c7 glsl2: added casts to silence warnings 2010-08-11 15:06:12 -06:00
Ian Romanick
5a7758efbe glsl2: Add ir_assignment::write_mask and associated methods
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.
2010-08-04 16:47:27 -07:00
Eric Anholt
0e19922558 glsl2: Allow use of _mesa_print_ir without a parse state on hand. 2010-07-29 15:09:31 -07:00
Eric Anholt
bf496862be glsl2: When dumping IR for debug, indent nested blocks.
No more trying to match parens in my head when looking at the body of
a short function containing an if statement.
2010-07-29 14:38:04 -07:00
Eric Anholt
9a8eb684d4 glsl2: When dumping IR for debug, skip all the empty builtin prototypes. 2010-07-29 14:38:04 -07:00
Kenneth Graunke
40c4298a6e ir_print_visitor: Add "temporary" to mode string printing.
Variables with mode ir_var_temporary were causing an out of bounds array
access and filling my screen with rubbish.  I'm not sure if "temporary"
is the right thing to print.
2010-07-22 16:50:36 -07:00
Kenneth Graunke
9930d18c2a ir_print_visitor: Print out constant arrays. 2010-07-21 16:38:33 -07:00
Kenneth Graunke
7ea977a15c ir_print_visitor: Remove commas between ir_constant's components.
The IR reader does not expect commas.
2010-07-21 16:38:33 -07:00
Kenneth Graunke
16efab1c4d glsl2: Define new ir_discard instruction. 2010-06-30 14:54:58 -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 ir_print_visitor.cpp (Browse further)