summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl/builtins: Switch comparison functions to just return an expression.Kenneth Graunke2010-09-185-360/+72
|
* glsl/builtins: Fix equal and notEqual builtins.Kenneth Graunke2010-09-183-48/+48
| | | | | Commit 309cd4115b7cba669a0bf858e7809cb6dae90ddf incorrectly converted these to all_equal and any_nequal, which is the wrong operation.
* glsl: Properly handle nested structure types.Kenneth Graunke2010-09-182-25/+11
| | | | Fixes piglit test CorrectFull.frag.
* glsl2: Fixed cloning of ir_call error instructions.Tilman Sauerbeck2010-09-181-0/+3
| | | | | | | Those have the callee field set to the null pointer, so calling the public constructor will segfault. Signed-off-by: Tilman Sauerbeck <[email protected]>
* glsl: Fix 'control reaches end of non-void function' warning.Vinson Lee2010-09-181-0/+1
| | | | | | | | | | | Fixes this GCC warning. lower_variable_index_to_cond_assign.cpp: In member function 'bool variable_index_to_cond_assign_visitor::needs_lowering(ir_dereference_array*) const': lower_variable_index_to_cond_assign.cpp:261: warning: control reaches end of non-void function
* glsl2: Empty functions can be inlined.Tilman Sauerbeck2010-09-181-1/+4
| | | | | Signed-off-by: Tilman Sauerbeck <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* glsl2: Add flags to enable variable index loweringIan Romanick2010-09-172-8/+52
|
* glsl2: Refactor testing for whether a deref is of a matrix or arrayIan Romanick2010-09-171-11/+12
|
* glsl: add pass to lower variable array indexing to conditional assignmentsLuca Barbieri2010-09-175-0/+317
| | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
* glsl: Don't print blank (function ...) headers for built-ins.Kenneth Graunke2010-09-161-0/+3
| | | | Fixes a regression caused when I added my GLSL ES support.
* glsl: Change from has_builtin_signature to has_user_signature.Kenneth Graunke2010-09-163-5/+5
| | | | | The print visitor needs this, and the only existing user can work with has_user_signature just as well.
* glsl: Fix 'format not a string literal and no format arguments' warning.Vinson Lee2010-09-151-1/+1
| | | | | | Fix the following GCC warning. loop_controls.cpp: In function 'int calculate_iterations(ir_rvalue*, ir_rvalue*, ir_rvalue*, ir_expression_operation)': loop_controls.cpp:88: warning: format not a string literal and no format arguments
* glsl2: add case for ir_unop_noiseBrian Paul2010-09-141-0/+4
| | | | | Silences a compiler warning. Still need to add some assertions for this case.
* glsl2: fix commentsBrian Paul2010-09-143-3/+3
|
* glsl2: Port equal() and notEqual() to ir_unop_all_equal and ir_unop_any_nequalIan Romanick2010-09-133-240/+48
|
* glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmpsLuca Barbieri2010-09-137-22/+67
| | | | | | | | | | | | | | | | | Currently GLSL IR forbids any vector comparisons, and defines "ir_binop_equal" and "ir_binop_nequal" to compare all elements and give a single bool. This is highly unintuitive and prevents generation of optimal Mesa IR. Hence, first rename "ir_binop_equal" to "ir_binop_all_equal" and "ir_binop_nequal" to "ir_binop_any_nequal". Second, readd "ir_binop_equal" and "ir_binop_nequal" with the same semantics as less, lequal, etc. Third, allow all comparisons to acts on vectors. Signed-off-by: Ian Romanick <[email protected]>
* loop_unroll: unroll loops with (lowered) breaksLuca Barbieri2010-09-131-4/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the loop ends with an if with one break or in a single break unroll it. Loops that end with a continue will have that continue removed by the redundant jump optimizer. Likewise loops that end with an if-statement with a break at the end of both branches will have the break pulled out after the if-statement. Loops of the form for (...) { do_something1(); if (cond) { do_something2(); break; } else { do_something3(); } } will be unrolled as do_something1(); if (cond) { do_something2(); } else { do_something3(); do_something1(); if (cond) { do_something2(); } else { do_something3(); /* Repeat inserting iterations here.*/ } } ir_lower_jumps can guarantee that all loops are put in this form and thus all loops are now potentially unrollable if an upper bound on the number of iterations can be found. Signed-off-by: Ian Romanick <[email protected]>
* glsl2: Add pass to remove redundant jumpsIan Romanick2010-09-136-1/+118
|
* glsl: Explain file naming conventionIan Romanick2010-09-131-0/+12
|
* loop_controls: fix analysis of already analyzed loopsLuca Barbieri2010-09-131-1/+8
| | | | | | The loop_controls pass didn't look at the counter values it put in ir_loop on previous iterations, so while the first iteration worked, subsequent ones couldn't determine max_iterations.
* glsl: add continue/break/return unification/elimination pass (v2)Luca Barbieri2010-09-136-250/+548
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* glsl: add ir_control_flow_visitorLuca Barbieri2010-09-131-0/+17
| | | | | | | | | | This is just a subclass of ir_visitor with empty implementations of all the visit methods for non-control flow nodes. Used to avoid duplicating that in ir_visitor subclasses. ir_hierarchical_visitor is another way to solve this, but is less natural for some applications.
* glsl2: Fix scons build for all platformsJakob Bornecrantz2010-09-101-0/+1
|
* glsl2: Implement noise[1234] built-in functions using ir_unop_noiseIan Romanick2010-09-095-104/+458
|
* glsl2: Add lowering pass to remove noise opcodesIan Romanick2010-09-094-1/+75
|
* glsl2: Add ir_unop_noiseIan Romanick2010-09-092-0/+5
|
* glsl/builtins: normalize of a negative scalar should be -1.0.Kenneth Graunke2010-09-092-2/+2
|
* glsl: add several EmitNo* options, and MaxUnrollIterationsLuca Barbieri2010-09-086-10/+12
| | | | | | | | | This increases the chance that GLSL programs will actually work. Note that continues and returns are not yet lowered, so linking will just fail if not supported. Signed-off-by: Ian Romanick <[email protected]>
* glsl: Add info about talloc and optimization passes to the README.Eric Anholt2010-09-081-0/+26
|
* glsl: Update README talking about multi-instruction operations.Eric Anholt2010-09-081-4/+4
| | | | | | The previous thing taking multiple instructions ended up being handled at the IR level, as we suggested would be the common result. Pick a new one.
* glsl/builtins: Set the API in the fake context.Kenneth Graunke2010-09-082-0/+2
| | | | Otherwise it gets used uninitialized.
* glsl2: Clear out profile pointers in _mesa_glsl_release_functionsIan Romanick2010-09-082-0/+2
| | | | | | Otherwise builtin_profiles contains dangling pointers the next time _mesa_read_profile is called. I suspect this may fix bugzilla #29847, but I was never able to reproduce it.
* glsl: Fix for scalar float built-in definitions.Kenneth Graunke2010-09-083-4/+4
| | | | These need abs, and we need more tests.
* glsl: regenerate builtinsEric Anholt2010-09-081-1/+1
|
* glsl: Fix typo in builtin step() using a wrong channel.Eric Anholt2010-09-081-1/+1
|
* ir_validate: Ensure ir_binop_dot is only used on vector types.Kenneth Graunke2010-09-081-0/+1
|
* glsl: Refresh automatically generated file builtin_function.cpp.Kenneth Graunke2010-09-081-11/+9
|
* glsl/builtins: Don't use ir_binop_dot on floating point values.Kenneth Graunke2010-09-084-6/+6
| | | | ir_binop_dot is only defined for vector types. Use ir_binop_mul.
* glsl/builtins: Simplify degenerate scalar float cases.Kenneth Graunke2010-09-083-5/+3
| | | | | | | The code being generated was just stupid, considering that: - normalize(x) = 1.0 - length(x) = x - distance(x, y) = x - y
* glsl2: Make sure _mesa_glsl_parse_state constructor gets a contextIan Romanick2010-09-082-2/+4
| | | | | Fix an major regression in dc754586. Too bad that change was obviously never tested.
* glsl: Support GLSL ES in the standalone compile.Chia-I Wu2010-09-081-1/+3
| | | | GLSL ES mode is enabled when --glsl-es is passed to glsl_compiler.
* glsl: Require a context in _mesa_glsl_parse_state.Chia-I Wu2010-09-082-62/+62
| | | | | Create a dummy context in the standalone compiler and pass it to _mesa_glsl_parse_state.
* glcpp: Fix build on non-GCC compilers.Kenneth Graunke2010-09-072-90/+92
|
* ast_to_hir: Mark arrays as lvalues in GLSL ES, but prohibit assignment.Kenneth Graunke2010-09-071-1/+7
| | | | | | This allows them to be passed as out/inout parameters, but still prevents them from being used as the target of an assignment. This is per section 5.8 of the GLSL ES 1.00 specification.
* glsl: Allow overloading of built-ins without hiding in GLSL ES.Kenneth Graunke2010-09-071-1/+1
| | | | The rules are explicitly different from desktop GLSL.
* glsl: Move is_builtin flag back to ir_function_signature.Kenneth Graunke2010-09-079-15/+28
| | | | | | | | | | | This effectively reverts b6f15869b324ae64a00d0fe46fa3c8c62c1edb6c. 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.
* ast_to_hir: Reject embedded structure definitions in GLSL ES 1.00.Kenneth Graunke2010-09-071-0/+9
|
* ast_to_hir: Reject unsized array declarations in GLSL ES 1.00.Kenneth Graunke2010-09-071-9/+18
|
* ast_to_hir: Allow matrix-from-matrix constructors in GLSL ES.Kenneth Graunke2010-09-071-1/+1
| | | | Everything but 1.10 supports this, so just change the check to ==.
* linker: Fix assertion and cross-version checks for version 100.Kenneth Graunke2010-09-071-2/+3
| | | | | | Fixes an assert (min_version >= 110) which was no longer correct, and also prohibits linking ES2 shaders with non-ES2 shaders. I'm not positive this is correct, but the specification doesn't seem to say.