summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_builder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl/ir_builder: Add helpers for making if-statementsChad Versace2013-01-241-0/+29
| | | | | | | | | | | Add two overloaded variants of ir_if *if_tree() The new functions allow one to chain together if-trees within a single C++ expression that resembles a real if-statement. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* glsl/ir_builder: Add more helpers for constructing expressionsChad Versace2013-01-241-0/+130
| | | | | | | | | | | | | | | | | Add the following functions, each of which construct the similarly named ir expression: div, round_even, clamp equal, less, greater, lequal, gequal logic_not, logic_and, logic_or bit_not, bit_or, bit_and, lshift, rshift f2i, i2f, f2u, u2f, i2u, u2i Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* glsl: change int->unsigned to silence MSVC warningsBrian Paul2012-11-061-1/+1
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* glsl/ir_builder: Add a new swizzle_for_size() function.Kenneth Graunke2012-07-121-0/+15
| | | | | | | | This swizzles away unwanted components, while preserving the order of the ones that remain. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl/ir_builder: Add a generic constructor for unary expressions.Kenneth Graunke2012-07-121-0/+8
| | | | | | | | | I needed to compute logs and square roots in a patch I was working on, and wanted to use the convenient interface. We already have a similar constructor for binops; adding one for unops seems reasonable. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Add a helper for generating temporary variables in ir_builder.Eric Anholt2012-04-131-0/+11
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add a helper for ir_builder to make dereferences for assignments.Eric Anholt2012-04-131-0/+18
| | | | | | v2: Fix writemask setup for non-vec4 assignments. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Make a little tracking class for emitting IR lists.Eric Anholt2012-04-131-0/+6
| | | | | | | This lets us significantly shorten p->instructions->push_tail(ir), and will be used in a few more places. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add common swizzles to ir_builder.Eric Anholt2012-04-131-0/+80
| | | | | | | | | | Now we can fold a bunch of our expression setup in ff_fragment_shader into single-line, parseable commits. v2: Make it actually work. I wasn't setting num_components in the mask structure, and not setting up a mask structure is way easier. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Let ir_builder expressions take un-dereferenced variables.Eric Anholt2012-04-131-10/+9
| | | | | | | | | | | Having to explicitly dereference is irritating and bloats the code, when the compiler can detect and do the right thing. v2: Use a little shim class to produce the automatic dereference generation at compile time as opposed to runtime, while also allowing compile-time type checking. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Create an ir_builder helper for hand-generating IR.Eric Anholt2012-04-131-0/+69
The C++ constructors with placement new, while functional, are extremely verbose, leading to generation of simple GLSL IR expressions like (a * b + c * d) expanding to many lines of code and using lots of temporary variables. By creating a new ir_builder.h that puts simple generators in our namespace and taking advantage of ralloc_parent(), we can generate much more compact code, at a minor runtime cost. v2: Replace ir_instruction usage with just ir_rvalue. v3: Drop remaining missed as_rvalue() in v2. Reviewed-by: Kenneth Graunke <[email protected]>