summaryrefslogtreecommitdiffstats
path: root/src/glsl/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Refactor source lists to Makefile.sourcesChia-I Wu2011-11-021-73/+9
| | | | | | | | With the hope that Android.mk and SConscript can share the file to reduce future breakage. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* linker: Add uniform_field_visitor class to process leaf fields of a uniformIan Romanick2011-10-251-0/+1
| | | | | Signed-off-by: Ian Romanick <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Implement a lowering pass for gl_ClipDistance.Paul Berry2011-09-231-0/+1
| | | | | | | | | | | | | | | | | | | In i965 GEN6+ (and I suspect most other hardware), gl_ClipDistance needs to be laid out as a pair of vec4's (the first containing clip distances 0-3, and the second containing clip distances 4-7). However, it is declared in GLSL as an array of 8 floats. This lowering pass acts at the GLSL level, modifying the declaration of gl_ClipDistance so that it is an array of vec4's rather than an array of floats, and renaming it to gl_ClipDistanceMESA. In addition, it modifies all accesses to the array so that they access the appropiate component of one of the vec4's. Since some hardware may not internally represent gl_ClipDistance as a pair of vec4's, this lowering pass is optional. To enable it, set the LowerClipDistance flag in gl_shader_compiler_options to true. Reviewed-by: Kenneth Graunke <[email protected]>
* make: Don't use builtin_stubs.cpp for standalone GLSL compiler.Kenneth Graunke2011-09-201-4/+4
| | | | | | | | | | | | | | | | builtin_stubs.cpp is only supposed to be used for builtin_compiler. It contains a stub version of _mesa_glsl_initialize_functions() that does nothing. libglsl.a already contains builtin_function.cpp, the generated file that contains a version of _mesa_glsl_initialize_functions() that actually initializes all the built-in functions. By mistakenly linking to builtin_stubs, glsl_compiler and glsl_test are unable to compile any shaders that use built-in functions. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* Add dependency generation for Mesa and GLSL dricore objects.Eric Anholt2011-07-281-0/+1
| | | | | Reviewed-By: Christopher James Halse Rogers <[email protected]>
* glsl: Create a standalone executable for testing optimization passes.Paul Berry2011-07-221-3/+21
| | | | | | | | | | | | | This patch adds a new build artifact, glsl_test, which can be used for testing optimization passes in isolation. I'm hoping that we will be able to add other useful standalone tests to this executable in the future. Accordingly, it is built in a modular fashion: the main() function uses its first argument to determine which test function to invoke, removes that argument from argv[], and then calls that function to interpret the rest of the command line arguments and perform the test. Currently the only test function is "optpass", which tests optimization passes.
* glsl: Move functions into standalone_scaffolding.cpp for later reuse.Paul Berry2011-07-221-1/+2
| | | | | | | | | | | | | | | | This patch moves the following functions from main.cpp (the main cpp file for the standalone executable that is used to create the built-in functions) to standalone_scaffolding.cpp, so that they can be re-used in other standalone executables: - initialize_context()* - _mesa_new_shader() - _mesa_reference_shader() *initialize_context contained some code that was specific to main.cpp, so it was split into two functions: initialize_context() (which remains in main.cpp), and initialize_context_from_defaults() (which is in standalone_scaffolding.cpp).
* glsl: Reject shaders that contain static recursionIan Romanick2011-07-201-0/+1
| | | | | | | | | | | | | | | | | | | The GLSL 1.20 and later specs say: "Recursion is not allowed, not even statically. Static recursion is present if the static function call graph of the program contains cycles." Recursion is detected and rejected both a compile-time and at link-time. The complie-time check happens to detect some cases that may be removed by various optimization passes. The spec doesn't seem to allow this, but other vendors (e.g., NVIDIA) appear to only check at link-time after all optimizations. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33885 Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix make clean for dricore.Eric Anholt2011-07-061-1/+1
|
* mesa: check that flex/bison are installedBrian Paul2011-05-181-4/+4
| | | | | | Fixes https://bugs.freedesktop.org/show_bug.cgi?id=36651 NOTE: This is a candidate for the 7.10 branch.
* autoconf: don't use CFLAGS for cpp filesTobias Droste2011-03-161-1/+1
| | | | Signed-off-by: Tobias Droste <[email protected]>
* glsl: Rename .lpp to .ll and .ypp to .yy.Kenneth Graunke2011-03-011-2/+2
| | | | | SCons has built-in support for .ll and .yy, but not .lpp and .ypp. Since there's no real benefit to using the old names, change them.
* glsl/Makefile: Remove builtin_function.cpp if generation fails.Arkadiusz Miskiewicz2011-02-261-1/+1
| | | | | | Fixes bug #34346. Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Remove $(PWD) from Makefile in favor of .Kenneth Graunke2011-02-191-1/+1
| | | | Hopefully should fix bug #34468.
* mesa: Optionally build a dricore support library (v3)Christopher James Halse Rogers2011-02-111-3/+31
| | | | | | | | | | | | | | | | | This an adds --enable-shared-dricore option to configure. When enabled, DRI modules will link against a shared copy of the common mesa routines rather than statically linking these. This saves about 30MB on disc with a full complement of classic DRI drivers. v2: Only enable with a gcc-compatible compiler that handles rpath Handle DRI_CFLAGS without filter-out magic Build shared libraries with the full mklib voodoo Fix typos v3: Resolve conflicts with talloc removal patches Signed-off-by: Christopher James Halse Rogers <[email protected]>
* glsl: Fix parallel build.Tobias Jakobi2011-02-111-1/+2
| | | | | | Broken since e0c1fc32832b66b52e6352ba563288ee48a1face. Signed-off-by: Kenneth Graunke <[email protected]>
* glsl/Makefile: glcpp doesn't need libglsl.a.Kenneth Graunke2011-02-101-1/+2
| | | | | Also, add a 'glcpp' target so you can type 'make glcpp' instead of 'make glcpp/glcpp'.
* glsl: Add a new opt_copy_propagation variant that does it channel-wise.Eric Anholt2011-02-041-0/+1
| | | | | | | | | | This patch cleans up many of the extra copies in GLSL IR introduced by i965's scalarizing passes. It doesn't result in a statistically significant performance difference on nexuiz high settings (n=3) or my demo (n=10), due to brw_fs.cpp's register coalescing covering most of those extra moves anyway. However, it does make the debug of wine's GLSL shaders much more tractable, and reduces instruction count of glsl-fs-convolution-2 from 376 to 288.
* glsl: Fix dependencies / linkage for glsl_compilerIan Romanick2011-01-311-2/+2
|
* Remove talloc from the make and automake build systems.Kenneth Graunke2011-01-311-4/+2
|
* ralloc: Add a fake implementation of ralloc based on talloc.Kenneth Graunke2011-01-311-0/+1
|
* glsl/Makefile: Fix build with --as-needed.Kenneth Graunke2011-01-121-1/+1
|
* glsl: Autogenerate builtin_functions.cpp as part of the build process.Kenneth Graunke2011-01-101-11/+8
| | | | | | 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.
* glsl: new glsl_strtod() wrapper to fix decimal point interpretationBrian Paul2010-12-141-0/+1
| | | | | | | | 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.
* glsl: Add a lowering pass to move discards out of if-statements.Kenneth Graunke2010-12-011-0/+1
| | | | | | | 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.
* glsl: Add an optimization pass to simplify discards.Kenneth Graunke2010-12-011-0/+1
| | | | NOTE: This is a candidate for the 7.9 branch.
* glsl: Combine many instruction lowering passes into one.Kenneth Graunke2010-11-191-4/+1
| | | | | | | 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 <[email protected]>
* glsl: Add ir_quadop_vector expressionIan Romanick2010-11-191-0/+1
| | | | | | | | | | The vector operator collects 2, 3, or 4 scalar components into a vector. Doing this has several advantages. First, it will make ud-chain tracking for components of vectors much easier. Second, a later optimization pass could collect scalars into vectors to allow generation of SWZ instructions (or similar as operands to other instructions on R200 and i915). It also enables an easy way to generate IR for SWZ instructions in the ARB_vertex_program assembler.
* glsl: Rename various ir_* files to lower_* and opt_*.Kenneth Graunke2010-11-151-23/+23
| | | | | This helps distinguish between lowering passes, optimization passes, and other compiler code.
* Fix build on systems where "python" is python 3.Kenneth Graunke2010-10-271-1/+1
| | | | | | | | | | | First, it changes autoconf to use a "python2" binary when available, rather than plain "python" (which is ambiguous). Secondly, it changes the Makefiles to use $(PYTHON) $(PYTHON_FLAGS) rather than calling python directly. Signed-off-by: Xavier Chantry <[email protected]> Signed-off-by: Matthew William Cox <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Add a lowering pass for texture projection.Eric Anholt2010-09-301-0/+1
|
* 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.