| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Otherwise it gets used uninitialized.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
These need abs, and we need more tests.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
ir_binop_dot is only defined for vector types. Use ir_binop_mul.
|
|
|
|
|
|
|
| |
The code being generated was just stupid, considering that:
- normalize(x) = 1.0
- length(x) = x
- distance(x, y) = x - y
|
|
|
|
|
| |
Fix an major regression in dc754586. Too bad that change was
obviously never tested.
|
|
|
|
| |
GLSL ES mode is enabled when --glsl-es is passed to glsl_compiler.
|
|
|
|
|
| |
Create a dummy context in the standalone compiler and pass it to
_mesa_glsl_parse_state.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
The rules are explicitly different from desktop GLSL.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
Everything but 1.10 supports this, so just change the check to ==.
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Also define it if #version 100 is encountered.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This should make it easier to change the default version based on the
API (say, version 1.00 for OpenGL ES).
Also, synchronize the symbol table's version with the parse state's
version just before doing AST-to-HIR. This way, it will be set when
it matters, but the main initialization code doesn't have to care about
the symbol table.
|
|
|
|
| |
Fixes bugzilla #30039.
|
|
|
|
|
|
|
|
|
|
|
|
| |
loop_analysis::visit(ir_dereference_variable *)
Returning early with visit_continue_with_parent prevented the
then-statements and else-statements of if-statements such as the
following from being processed:
if (some_var) { ... } else { ... }
Fixes piglit test case glsl-fs-loop-nested-if and bugzilla #30030.
|
|
|
|
|
|
| |
Fixes piglit test case loop-06.vert.
Unfortunately, causes 1 shift/reduce conflict.
|
|
|
|
|
|
|
| |
Otherwise spring 0.82+.4.0 crashes when starting a game
because prog->_LinkedShaders[0] is NULL.
This also fixes piglit test cases glsl-link-empty-prog-0[12].
|
| |
|
|
|
|
|
|
|
|
|
| |
This extra validation is very useful when working on the built-ins, but
in general overkill - the results should stay the same unless the
built-ins or ir_validate have changed.
Also, validating all the built-in functions in every test case makes
piglit run unacceptably slow.
|
|
|
|
| |
It's just too easy to get something wrong in hand-written IR.
|