summaryrefslogtreecommitdiffstats
path: root/src/glsl/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* glsl: add pass to lower variable array indexing to conditional assignmentsLuca Barbieri2010-09-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* glsl2: Add pass to remove redundant jumpsIan Romanick2010-09-131-0/+1
|
* glsl: add continue/break/return unification/elimination pass (v2)Luca Barbieri2010-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* glsl2: Add lowering pass to remove noise opcodesIan Romanick2010-09-091-0/+1
|
* glsl2: Add module to perform simple loop unrollingIan Romanick2010-09-031-0/+1
|
* glsl2: Add module to suss out loop control variables from loop analysis dataIan Romanick2010-09-031-0/+1
| | | | This is the next step on the road to loop unrolling
* glsl2: Add module to analyze variables used in loopsIan Romanick2010-09-031-0/+1
| | | | This is the first step eventually leading to loop unrolling.
* glsl: Use a single shared namespace in the symbol table.Kenneth Graunke2010-08-261-0/+1
| | | | | | | | | | | | As of 1.20, variable names, function names, and structure type names all share a single namespace, and should conflict with one another in the same scope, or hide each other in nested scopes. However, in 1.10, variables and functions can share the same name in the same scope. Structure types, however, conflict with/hide both. Fixes piglit tests redeclaration-06.vert, redeclaration-11.vert, redeclaration-19.vert, and struct-05.vert.
* glsl: make 'make clean' work properly.Dave Airlie2010-08-241-1/+1
| | | | this has make clean remove all the objects.
* mesa: AC_SUBST the talloc libs/cflags so the ./configure results are saved.Eric Anholt2010-08-221-1/+2
| | | | | | | | | | I had used pkg-config from the Makefile because I didn't want to screw around with the non-autoconf build, but that doesn't work because the PKG_CONFIG_PATH or TALLOC_LIBS/TALLOC_CFLAGS that people set at configure time needs to be respected and may not be present at build time. Bug #29585
* glsl2/Makefile: Add a 'make builtins' target.Kenneth Graunke2010-08-131-1/+6
| | | | | | | | | This copies over a dummy builtin_functions.cpp and rebuilds a bootstrapped version of the compiler, then uses that to generate the proper list of builtins. Finally, it rebuilds the compiler with the new list. Unfortunately, it's no longer automatic, but at least it works.
* glsl2: Rework builtin function generation.Kenneth Graunke2010-08-131-2/+3
| | | | | | | | | | | | | | | | Each language version/extension and target now has a "profile" containing all of the available builtin function prototypes. These are written in GLSL, and come directly out of the GLSL spec (except for expanding genType). A new builtins/ir/ folder contains the hand-written IR for each builtin, regardless of what version includes it. Only those definitions that have prototypes in the profile will be included. The autogenerated IR for texture builtins is no longer written to disk, so there's no longer any confusion as to what's hand-written or generated. All scripts are now in python instead of perl.
* glsl2: Add a pass to strip out noop swizzles.Eric Anholt2010-08-131-0/+1
| | | | | | With the glsl2-965 branch, the optimization of glsl-algebraic-rcp-rcp regressed due to noop swizzles hiding information from ir_algebraic. This cleans up those noop swizzles for us.
* glsl2: Add a generic visitor class to call back with pointers to each rvalue.Eric Anholt2010-08-131-0/+1
| | | | | I keep copy and pasting this code all over, so consolidate it in one place.
* glsl2: Use --nounistd to fix MSVC buildIan Romanick2010-08-131-2/+2
| | | | | Also remove the --never-interactive command line option for the preprocessor lexer. This was already done for main compiler lexer.
* glsl2: Change command line options passed to flexIan Romanick2010-08-111-1/+1
| | | | | | | | | Remove --never-interactive because it is already specified in the source using %option. Use -o instead of --outfile. Some of the %option commands may also need to be removed for compatibility with older versions (e.g., 2.5.4) of flex. This should fix bugzilla #29209.
* glsl2: Use bison command line option to set prefixIan Romanick2010-08-111-1/+1
| | | | | | Bison version 2.3 doesn't seem to support %name-prefix in the source. This should fix bugzilla #29207.
* glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1))Eric Anholt2010-08-091-0/+1
| | | | | | All the current HW backends transform subtract to adding the negation, so I haven't bothered peepholing it back out in Mesa IR. This allows some subtract of subtract to get removed in ir_algebraic.
* glsl2: Add constant propagation.Eric Anholt2010-08-091-0/+1
| | | | | | | | Whereas constant folding evaluates constant expressions at rvalue nodes, constant propagation tracks constant components of vectors across execution to replace (possibly swizzled) variable dereferences with constant values, triggering possible constant folding or reduced variable liveness.
* glsl2: Move gl_program->InputsRead/OutputsWritten setting to an ir pass.Eric Anholt2010-08-061-0/+1
| | | | | | | This lets us handle arrays much better than trying to work backwards from assembly. Fixes fbo-drawbuffers-maxtargets on swrast (i965 needs loop unrolling)
* glsl2: Add a pass to convert exp and log to exp2 and log2.Eric Anholt2010-08-051-0/+1
| | | | | | | | | Fixes ir_to_mesa handling of unop_log, which used the weird ARB_vp LOG opcode that doesn't do what we want. This also lets the multiplication coefficients in there get constant-folded, possibly. Fixes: glsl-fs-log
* ir_structure_splitting: New pass to chop structures into their components.Eric Anholt2010-08-051-0/+1
| | | | | | | This doesn't do anything if your structure goes through an uninlined function call or if whole-structure assignment occurs. As such, the impact is limited, at least until we do some global copy propagation to reduce whole-structure assignment.
* glsl2: Add a pass for removing unused functions.Eric Anholt2010-08-051-0/+1
| | | | | | | | | For a shader involving many small functions, this avoids running optimization across all of them after they've been inlined post-linking. Reduces the runtime of linking and running a fragment shader from Yo Frankie from 1.6 seconds to 0.9 seconds (-44.9%, +/- 3.3%).
* glcpp: Remove xtalloc wrappers in favor of plain talloc.Kenneth Graunke2010-08-041-2/+1
| | | | | | Calling exit() on a memory failure probably made sense for the standalone preprocessor, but doesn't seem too appealing as part of the GL library. Also, we don't use it in the main compiler.
* glsl2: Don't add mesa/program/ as an include dir. Let includes say program/.Eric Anholt2010-08-021-1/+0
|
* glsl2: Add new tree grafting optimization pass.Eric Anholt2010-07-311-0/+1
|
* glsl2: Factor out the variable refcounting part of ir_dead_code.cpp.Eric Anholt2010-07-311-0/+1
|
* glsl2/Makefile: Append to DEFINES rather than replacing them.Kenneth Graunke2010-07-281-1/+1
| | | | | Otherwise, we lose DEBUG, which causes mtypes.h to set NDEBUG, which causes assertions to not happen, which is no fun for anyone.
* glsl2: Add optimization pass for algebraic simplifications.Eric Anholt2010-07-271-0/+1
| | | | | | This cleans up the assembly output of almost all the non-logic tests glsl-algebraic-*. glsl-algebraic-pow-two needs love (basically, flattening to a temporary and squaring it).
* Merge remote branch 'origin/master' into glsl2Eric Anholt2010-07-261-4/+4
|\ | | | | | | | | | | | | | | | | | | | | This pulls in multiple i965 driver fixes which will help ensure better testing coverage during development, and also gets past the conflicts of the src/mesa/shader -> src/mesa/program move. Conflicts: src/mesa/Makefile src/mesa/main/shaderapi.c src/mesa/main/shaderobj.h
* | glsl2: Add the API defines to the glsl2 build so we get the right GLcontextEric Anholt2010-07-221-2/+6
| | | | | | | | | | | | | | Fixes: draw_buffers-08.frag draw_buffers-09.frag glsl-vs-texturematrix-2
* | glsl2: Add function to import function prototypes from one IR tree to anotherIan Romanick2010-07-211-0/+1
| |
* | glsl2: Add a constructor for _mesa_glsl_parse_stateIan Romanick2010-07-201-0/+1
| | | | | | | | Coming changes to the handling of built-in functions necessitate this.
* | Build a standalone glcpp binary.Carl Worth2010-07-201-3/+17
| | | | | | | | | | This is convenient for testing the preprocessor independent of the rest of mesa, (just run glcpp-test in the src/glsl/glcpp/tests).
* | linker: First bits of intrastage, intershader function linkingIan Romanick2010-07-191-0/+1
| | | | | | | | | | | | 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.
* | glsl2: Add a pass for converting if statements to conditional assignment.Eric Anholt2010-07-191-0/+1
| | | | | | | | This will be used on 915 and similar hardware of that generation.
* | glsl2: Add a new pass at the IR level to break down matrix ops to vector ops.Eric Anholt2010-07-121-0/+1
| | | | | | | | | | | | | | This will be used by the Mesa IR and likely most HW backends, as it allows other optimizations to occur that might not otherwise. Fixes glsl-vs-mat-sub-1, glsl-vs-mat-div-1.
* | glsl2: Add a pass to simplify if statements returning from both sides.Eric Anholt2010-07-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows function inlining making the following tests work even without function calls implemented: glsl-fs-functions-2 glsl-fs-functions-3 glsl-vs-functions glsl-vs-functions-2 glsl-vs-functions-3 glsl-vs-vec4-indexing-5 (Note that those tests were designed to trigger actual function calls, and this defeats them. However, those testcases ended up catching the bug in the previous commit.)
* | glsl2: Add pass for supporting variable vector indexing in rvalues.Eric Anholt2010-07-061-0/+1
| | | | | | | | | | | | | | The Mesa IR needs this to support vector indexing correctly, and hardware backends such as 915 would want this behavior as well. Fixes glsl-vs-vec4-indexing-2.
* | glsl2: Add a pass to break ir_binop_div to _mul and _rcp.Eric Anholt2010-07-021-0/+1
| | | | | | | | This results in constant folding of a constant divisor.
* | glsl2: Add a pass to convert mod(a, b) to b * fract(a/b).Eric Anholt2010-07-011-0/+1
| | | | | | | | This is used by the Mesa IR backend to implement mod, fixing glsl-fs-mod.
* | glsl2: Fix dependencies. (at least partially)Eric Anholt2010-06-251-2/+7
| |
* | glsl2: Replace the GLSL compiler with the glsl2 project.Eric Anholt2010-06-241-8/+122
|/
* Build mesa glsl with make.michal2009-12-101-0/+15
Still don't know how to add glsl to mesa dependencies.