Commit Graph

22 Commits

Author SHA1 Message Date
José Fonseca
416ca90138 glsl: Make builtin_compiler build on Windows with MSVC. 2011-01-12 16:58:37 +00:00
José Fonseca
6d670f6c0f getopt: Import OpenBSD getopt implementation for MSVC. 2011-01-12 15:32:17 +00:00
Kenneth Graunke
33d0c44910 glsl: Autogenerate builtin_functions.cpp as part of the build process.
Python is already necessary for other parts of Mesa, so there's no
reason we can't just generate it.  This patch updates both make and
SCons to do so.
2011-01-10 19:03:27 -08:00
Brian Paul
bb10e081c8 glsl: new glsl_strtod() wrapper to fix decimal point interpretation
We always want to use '.' as the decimal point.

See http://bugs.freedesktop.org/show_bug.cgi?id=24531

NOTE: this is a candidate for the 7.10 branch.
2010-12-14 12:38:38 -07:00
Kenneth Graunke
940df10100 glsl: Add a lowering pass to move discards out of if-statements.
This should allow lower_if_to_cond_assign to work in the presence of
discards, fixing bug #31690 and likely #31983.

NOTE: This is a candidate for the 7.9 branch.
2010-12-01 11:52:43 -08:00
Kenneth Graunke
9a1d063c6d glsl: Add an optimization pass to simplify discards.
NOTE: This is a candidate for the 7.9 branch.
2010-12-01 11:52:43 -08:00
Vinson Lee
7aebe181f3 glsl: Add lower_vector.cpp to SConscript. 2010-11-19 17:23:07 -08:00
Kenneth Graunke
63684a9ae7 glsl: Combine many instruction lowering passes into one.
This should save on the overhead of tree-walking and provide a
convenient place to add more instruction lowering in the future.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-11-19 15:56:28 -08:00
Vinson Lee
1935bdca44 glsl: Add ir_constant_expression.cpp to SConscript.
This was accidentally removed in commit 32aaf89823.

Fixes SCons builds.
2010-11-15 20:56:11 -08:00
Brian Paul
9b4b70e7e2 glsl: remove opt_constant_expression.cpp from SConscript
And alphabetize the opt_* files.
2010-11-15 18:59:45 -07:00
Kenneth Graunke
32aaf89823 glsl: Rename various ir_* files to lower_* and opt_*.
This helps distinguish between lowering passes, optimization passes, and
other compiler code.
2010-11-15 16:34:20 -08:00
Luca Barbieri
a47539c7a1 glsl: add pass to lower variable array indexing to conditional assignments
Currenly GLSL happily generates indirect addressing of any kind of
arrays.

Unfortunately DirectX 9 GPUs are not guaranteed to support any of them in
general.

This pass fixes that by lowering such constructs to a binary search on the
values, followed at the end by vectorized generation of equality masks, and
4 conditional assignments for each mask generation.

Note that this requires the ir_binop_equal change so that we can emit SEQ
to generate the boolean masks.

Unfortunately, ir_structure_splitting is too dumb to turn the resulting
constant array references to individual variables, so this will need to
be added too before this pass can actually be effective for temps.

Several patches in the glsl2-lower-variable-indexing were squashed
into this commit.  These patches fix bugs in Luca's original
implementation, and the individual patches can be seen in that branch.
This was done to aid bisecting in the future.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-17 10:58:58 +02:00
Ian Romanick
8f2214f489 glsl2: Add pass to remove redundant jumps 2010-09-13 14:25:26 -07:00
Luca Barbieri
3361cbac2a glsl: add continue/break/return unification/elimination pass (v2)
Changes in v2:
- Base class renamed to ir_control_flow_visitor
- Tried to comply with coding style

This is a new pass that supersedes ir_if_return and "lowers" jumps
to if/else structures.

Currently it causes no regressions on softpipe and nv40, but I'm not sure
whether the piglit glsl tests are thorough enough, so consider this
experimental.

It can be asked to:
1. Pull jumps out of ifs where possible
2. Remove all "continue"s, replacing them with an "execute flag"
3. Replace all "break" with a single conditional one at the end of the loop
4. Replace all "return"s with a single return at the end of the function,
   for the main function and/or other functions

This gives several great benefits:
1. All functions can be inlined after this pass
2. nv40 and other pre-DX10 chips without "continue" can be supported
3. nv30 and other pre-DX10 chips with no control flow at all are better supported

Note that for full effect we should also teach the unroller to unroll
loops with a fixed maximum number of iterations but with the canonical
conditional "break" that this pass will insert if asked to.

Continues are lowered by adding a per-loop "execute flag", initialized to
TRUE, that when cleared inhibits all execution until the end of the loop.

Breaks are lowered to continues, plus setting a "break flag" that is checked
at the end of the loop, and trigger the unique "break".

Returns are lowered to breaks/continues, plus adding a "return flag" that
causes loops to break again out of their enclosing loops until all the
loops are exited: then the "execute flag" logic will ignore everything
until the end of the function.

Note that "continue" and "return" can also be implemented by adding
a dummy loop and using break.
However, this is bad for hardware with limited nesting depth, and
prevents further optimization, and thus is not currently performed.
2010-09-13 13:03:09 -07:00
Jakob Bornecrantz
379e2e77ba glsl2: Fix scons build for all platforms 2010-09-10 01:17:56 +02:00
José Fonseca
1c009f970e glsl: Add new files to sconscript. 2010-09-05 10:17:51 +01:00
José Fonseca
58087b8d27 scons: Add glsl_symbol_table.cpp 2010-08-26 18:19:57 +01:00
José Fonseca
2322404b55 scons: Add new source files. 2010-08-14 12:45:14 +01:00
José Fonseca
3a3cdb909d scons: Build the new glsl2 code. 2010-08-13 13:55:34 +01:00
José Fonseca
7abdaf574a scons: Fix xlib build.
After glsl rework merge.
2009-12-28 22:53:40 +00:00
Keith Whitwell
b2a615e3cd glsl/pp: move static functions out of header file 2009-12-23 16:10:37 +00:00
José Fonseca
491f384c39 scons: Get GLSL code building correctly when cross compiling.
This is quite messy. GLSL code has to be built twice: one for the
host OS, another for the target OS.
2009-12-10 16:30:08 +00:00