History log of /external/mesa3d/src/glsl/ast_function.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
4d9c3cbce9e1ff45e5a90dda4de4934599b88037 14-Jun-2012 Paul Berry <stereotype441@gmail.com> glsl: Use ir_unop_f2u to convert floats to uints.

Fixes piglit tests
spec/glsl-1.30/execution/{vs,fs}-float-uint-conversion on i965.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_function.cpp
6e4852a3a5f3cbe52c53d91d343a37861f207563 02-May-2012 Olivier Galibert <galibert@pobox.com> glsl: Add a variable context to constant_expression_value().

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net> [v1]
/external/mesa3d/src/glsl/ast_function.cpp
4595288ba844def45cc858fab44fad3efa1ab4c8 24-Apr-2012 Eric Anholt <eric@anholt.net> glsl: Fix regression in function out-parameter lvalue detection.

When doing the var->assigned change in
f2475ca424f7e001be50f64dafa5700f6603d684, I overzealously indented the
second block of code into the "if (var)" test. Revert these blocks to
the way they were before, just taking advantage of "var" to avoid
re-calling variable_referenced().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49066
/external/mesa3d/src/glsl/ast_function.cpp
f2475ca424f7e001be50f64dafa5700f6603d684 30-Mar-2012 Eric Anholt <eric@anholt.net> glsl: Track in each ir_variable whether it was ever assigned.

This will be used for some compile-and-link-time error checking, where
currently we've been doing error checking only at link time.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_function.cpp
f75c2d53146ea14f8dfedcc5b7a4704278ba0792 21-Sep-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Demote 'type' from ir_instruction to ir_rvalue and ir_variable.

Variables have types, expression trees have types, but statements don't.
Rather than have a nonsensical field that stays NULL in the base class,
just move it to where it makes sense.

Fix up a few places that lazily used ir_instruction even though they
actually knew the particular subclass.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_function.cpp
d884f60861f270cdcf7d9d47765efcf1e1de30b6 20-Mar-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Convert ir_call to be a statement rather than a value.

Aside from ir_call, our IR is cleanly split into two classes:
- Statements (typeless; used for side effects, control flow)
- Values (deeply nestable, pure, typed expression trees)

Unfortunately, ir_call confused all this:
- For void functions, we placed ir_call directly in the instruction
stream, treating it as an untyped statement. Yet, it was a subclass
of ir_rvalue, and no other ir_rvalue could be used in this way.
- For functions with a return value, ir_call could be placed in
arbitrary expression trees. While this fit naturally with the source
language, it meant that expressions might not be pure, making it
difficult to transform and optimize them. To combat this, we always
emitted ir_call directly in the RHS of an ir_assignment, only using
a temporary variable in expression trees. Many passes relied on this
assumption; the acos and atan built-ins violated it.

This patch makes ir_call a statement (ir_instruction) rather than a
value (ir_rvalue). Non-void calls now take a ir_dereference of a
variable, and store the return value there---effectively a call and
assignment rolled into one. They cannot be embedded in expressions.

All expression trees are now pure, without exception.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_function.cpp
807e967c615dc80a264af5a89af7649f95481744 23-Sep-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Use ir_rvalue to represent generic error_type values.

Currently, ir_call can be used as either a statement (for void
functions) or a value (for non-void functions). This is rather awkward,
as it's the only class that can be used in both forms.

A number of places use ir_call::get_error_instruction() to construct a
generic value of error_type. If ir_call is to become a statement, it
can no longer serve this purpose.

Unfortunately, none of our classes are particularly well suited for
this, and creating a new one would be rather aggrandizing. So, this
patch introduces ir_rvalue::error_value(), a static method that creates
an instance of the base class, ir_rvalue. This has the nice property
that you can't accidentally try and access uninitialized fields (as it
doesn't have any). The downside is that the base class is no longer
abstract.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_function.cpp
ac0f8bae8d39ca9f5e873ba8411472e2962890cd 29-Mar-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Combine AST-level and IR-level parameter mode checking loops.

generate_call() and ast_function_expression::hir() both tried to verify
that 'out' and 'inout' parameters used l-values. Irritatingly, it
turned out that this was not redundant; both checks caught -some- cases.

This patch combines the two into a single "complete" function that does
all the parameter mode checking. It also adds a comment clarifying why
AST-level checking is necessary in the first place.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_function.cpp
909e8899671a45bcc865fe303a8cb697a25634aa 29-Mar-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Split up function matching and call generation a bit more.

We used to have one big function, match_signature_by_name, which found
a matching signature, performed out-parameter conversions, and generated
the ir_call. As the code for matching against built-in functions became
more complicated, I split it internally, creating generate_call().

However, I left the same awkward interface. This patch splits it into
three functions:
1. match_signature_by_name()

This now takes a name, a list of parameters, the symbol table, and
returns an ir_function_signature. Simple and one purpose: matching.

2. no_matching_function_error()

Generate the "no matching function" error and list of prototypes.
This was complex enough that I felt it deserved its own function.

3. generate_call()

Do the out-parameter conversion and generate the ir_call. This
could probably use more splitting.

The caller now has a more natural workflow: find a matching signature,
then either generate an error or a call.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_function.cpp
208b5b113faab324854d457c3ad4abf05cafedd1 23-Dec-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Emit extra errors for l-value violations in 'out' or 'inout' parameters

Somethings, like pre-increment operations, were not previously caught.
After the 8.0 release, this code needs some major refactoring and
clean-up. It's a mess. :(

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42755
/external/mesa3d/src/glsl/ast_function.cpp
f1a677cefbe91a5c1a72dbeda94d2f13a9369e54 11-Nov-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Always search for an exact function signature match.

Previously, we would fail to compile the following shader due to a bug
in lazy built-in importing:

#version 130
void main() {
float f = abs(5.0);
int i = abs(5);
}

The first call, abs(5.0), would fail to find a local signature, look
through the built-ins, and import "float abs(float)".

The second call, abs(5), would find the newly imported float signature
in the local shader, and settle for that. Unfortunately, it failed to
search the built-ins for the correct/exact signature, "int abs(int)".

Thus, abs(5) ended up being a float, causing a bizarre type error when
we tried to assign it to an int.

Fixes piglit test builtin-overload-matching.frag.

This is /not/ a candidate for stable branches, as it should only be
possible to trigger this bug using GLSL 1.30's built-in functions that
take integer arguments. Plus, the changes are fairly invasive.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_function.cpp
cdc94082664c329e6c55cf6053893360946275bf 09-Nov-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Split code to generate an ir_call out from match_function_by_name.

match_function_by_name performs two fairly separate tasks:
1. Hunt down the appropriate ir_function_signature for the callee.
2. Generate the actual ir_call (assuming we found the callee).

Both of these are complicated. The first has to handle exact/inexact
matches, lazy importing of built-in prototypes, different scoping rules
for 1.10, 1.20+, and ES. Not to mention printing a user-friendly error
message with pretty-printed "maybe you meant this" candidate signatures.

The second has to deal with void/non-void functions, pre-call implicit
conversions for "in" parmeters, and post-call "out" call conversions.

Trying to do both in one function is just too unwieldy. Time to split.

This patch purely moves the code to generate an ir_call into a separate
function and reindents it. Otherwise, the code is identical.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
/external/mesa3d/src/glsl/ast_function.cpp
0fabf8e8dc96a0eb8a9fbbac760d4faceee3af48 20-Sep-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Defer initialization of built-in functions until they're needed.

Very simple shaders don't actually use GLSL built-ins. For example:
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_FragColor = vec4(0.0);
Both of the shaders used by _mesa_meta_glsl_Clear() also qualify.

By waiting to initialize the built-ins until the first time we need to
look for a signature, we can avoid the overhead entirely in these cases.

Makes piglit run roughly 18% faster (255 vs. 312 seconds).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ast_function.cpp
8ce716257a3529d0aa750d7a7b344984c5ac4274 25-Aug-2011 Dave Airlie <airlied@redhat.com> glsl: fix crash when a const is passed to texelFetchOffset

while debugging texelFetchOffset we kept hitting the assert.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_function.cpp
c25b4943322ddd31d70d87464fe32be26ac6c858 25-Aug-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Bail after reporting an error for non-constant const_in parameters.

Otherwise we continue and hit the "Illegal formal parameter mode"
assertion.

Fixes negative compile test texelFetchOffset.frag in piglit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/external/mesa3d/src/glsl/ast_function.cpp
67b5a3267d639c31d3ac4073be877ffb0f5637d3 02-Aug-2011 Paul Berry <stereotype441@gmail.com> glsl: Perform implicit type conversions on function call out parameters.

When an out parameter undergoes an implicit type conversion, we need
to store it in a temporary, and then after the call completes, convert
the resulting value. In other words, we convert code like the
following:

void f(out int x);
float value;
f(value);

Into IR that's equivalent to this:

void f(out int x);
float value;
int out_parameter_conversion;
f(out_parameter_conversion);
value = float(out_parameter_conversion);

This transformation needs to happen during ast-to-IR convertion (as
opposed to, say, a lowering pass), because it is invalid IR for formal
and actual parameters to have types that don't match.

Fixes piglit tests
spec/glsl-1.20/compiler/qualifiers/out-conversion-int-to-float.vert and
spec/glsl-1.20/execution/qualifiers/vs-out-conversion-*.shader_test,
and bug 39651.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39651

Reviewed-by: Chad Versace <chad@chad-versace.us>
/external/mesa3d/src/glsl/ast_function.cpp
789ee6516bfca289e1948ff8f2c147b94286a0e0 30-Jul-2011 Paul Berry <stereotype441@gmail.com> glsl: Constant-fold built-in functions before outputting IR

Rearranged the logic for converting the ast for a function call to
hir, so that we constant fold before emitting any IR. Previously we
would emit some IR, and then only later detect whether we could
constant fold. The unnecessary IR would usually get cleaned up by a
later optimization step, however in the case of a builtin function
being used to compute an array size, it was causing an assertion.

Fixes Piglit test array-size-constant-relational.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38625
/external/mesa3d/src/glsl/ast_function.cpp
0d81b0e18494a80c4326fbc98837842959675869 30-Jul-2011 Paul Berry <stereotype441@gmail.com> glsl: Emit function signatures at toplevel, even for built-ins.

The ast-to-hir conversion needs to emit function signatures in two
circumstances: when a function declaration (or definition) is
encountered, and when a built-in function is encountered.

To avoid emitting a function signature in an illegal place (such as
inside a function), emit_function() checked whether we were inside a
function definition, and if so, emitted the signature before the
function definition.

However, this didn't cover the case of emitting function signatures
for built-in functions when those built-in functions are called from
inside the constant integer expression that specifies the length of a
global array. This failed because when processing an array length, we
are emitting IR into a dummy exec_list (see process_array_type() in
ast_to_hir.cpp). process_array_type() later checks (via an assertion)
that no instructions were emitted to the dummy exec_list, based on the
reasonable assumption that we shouldn't need to emit instructions to
calculate the value of a constant.

This patch changes emit_function() so that it emits function
signatures at toplevel in all cases.

This partially fixes bug 38625
(https://bugs.freedesktop.org/show_bug.cgi?id=38625). The remainder
of the fix is in the patch that follows.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_function.cpp
a5ab9398e34287ed8cbb010d0758790e6692530c 27-Jul-2011 Chad Versace <chad@chad-versace.us> glsl: Fix conversions in array constructors

Array constructors obey narrower conversion rules than other constructors
[1] --- they use the implicit conversion rules [2] instead of the scalar
constructor conversions [3]. But process_array_constructor() was
incorrectly applying the broader rules.

[1] GLSL 1.50 spec, Section 5.4.4 Array Constructors, page 52 (58 of pdf)
[2] GLSL 1.50 spec, Section 4.1.10 Implicit Conversions, page 25 (31 of pdf)
[3] GLSL 1.50 spec, Section 5.4.1 Conversion, page 48 (54 of pdf)

To fix this, first check (with glsl_type::can_be_implicitly_converted_to)
if an implicit conversion is legal before performing the conversion.

Fixes:
piglit:spec/glsl-1.20/compiler/structure-and-array-operations/array-ctor-implicit-conversion-bool-float.vert
piglit:spec/glsl-1.20/compiler/structure-and-array-operations/array-ctor-implicit-conversion-bvec*-vec*.vert

Note: This is a candidate for the 7.10 and 7.11 branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
/external/mesa3d/src/glsl/ast_function.cpp
1ad3ba4ad954b86751bd5b6ad0a431920bff9958 08-Jul-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Make prototype_string publicly available

Also clarify the documentation for one of the parameters.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_function.cpp
6b1ba7ccef18232e5586fcda2ff75ef5bd05b57b 15-Jun-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Use i2u and u2i to implement constructor conversions.

Inspired by a patch from Bryan Cain <bryancain3@gmail.com>.

Fixes piglit tests:
- ctor-int-uint.vert
- ctor-ivec4-uvec4.vert
- ctor-uint-int.vert
- ctor-uvec4-ivec4.vert

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ast_function.cpp
0f0179b8c278854fdbef283c5abaf95ad33351c3 03-May-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Remove extra newline from error message
/external/mesa3d/src/glsl/ast_function.cpp
edf2e4f79d5b27cb909b37fabc35e68d14af0834 19-Apr-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: 80-column wrapping and whitespace fixes
/external/mesa3d/src/glsl/ast_function.cpp
884215894493bdbc55abd567c121c9df06ae3bc7 28-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Finish out the reduce/reduce error fixes

Track variables, functions, and types during parsing. Use this
information in the lexer to return the currect "type" for identifiers.

Change the handling of structure constructors. They will now show up
in the AST as constructors (instead of plain function calls).

Fixes piglit tests constructor-18.vert, constructor-19.vert, and
constructor-20.vert. Also fixes bugzilla #29926.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/ast_function.cpp
cfd8d45ccde3252fd9a27fe0b2031a35f437a6a2 02-Feb-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Fix invalid use of ralloc_asprintf in prototype_string.

This was my mistake when converting from talloc to ralloc. I was
confused because the other calls in the function are to asprintf_append
and the original code used str as the context rather than NULL.

Fixes bug #33823.
/external/mesa3d/src/glsl/ast_function.cpp
59c957b688651a4c7fa4660ee7a404bd83e8bb0b 31-Jan-2011 Brian Paul <brianp@vmware.com> glsl: add cast to silence signed/unsigned comparison warning
/external/mesa3d/src/glsl/ast_function.cpp
819d57fce94b20fa0d34da6f037f0a53c4a5bdc2 13-Jan-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Introduce a new "const_in" variable mode.

This annotation is for an "in" function parameter for which it is only legal
to pass constant expressions. The only known example of this, currently,
is the textureOffset functions.

This should never be used for globals.
/external/mesa3d/src/glsl/ast_function.cpp
d3073f58c17d8675a2ecdd5dfa83e5520c78e1a8 21-Jan-2011 Kenneth Graunke <kenneth@whitecape.org> Convert everything from the talloc API to the ralloc API.
/external/mesa3d/src/glsl/ast_function.cpp
b66be7518ad57368b31b5d70a2bb4c0fe66aa988 21-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Improve error message when read-only vars are written

Improves the cases when:
* an explicit assignment references the read-only variable
* an 'out' or 'inout' function parameter references the read-only variable
/external/mesa3d/src/glsl/ast_function.cpp
c17c7903871b031162e41d6495a1bef64844e19b 06-Dec-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Properly add functions during lazy built-in prototype importing.

The original lazy built-in importing patch did not add the newly created
function to the symbol table, nor actually emit it into the IR stream.

Adding it to the symbol table is non-trivial since importing occurs when
generating some ir_call in a nested scope. A new add_global_function
method, backed by new symbol_table code in the previous patch, handles
this.

Fixes bug #32030.
/external/mesa3d/src/glsl/ast_function.cpp
f5692f452f7ae77d1e710041ffebb468cc5ba87b 11-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Lazily import built-in function prototypes.

This makes a very simple 1.30 shader go from 196k of memory to 9k.

NOTE: This -may- be a candidate for the 7.9 branch, as the benefit is
substantial. However, it's not a simple change, so it may be wiser to
wait for 7.10.
/external/mesa3d/src/glsl/ast_function.cpp
bb756bb0a6935b7e0d8fd2f9d61c0437fef7d770 20-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Fix matrix constructors with vector parameters

When the semantics of write masks in assignments were changed, this
code was not correctly updated.

Fixes piglit test glsl-mat-from-vec-ctor-01.
/external/mesa3d/src/glsl/ast_function.cpp
2d2d6a80c14612de683001d24cbbbb9a8f620dd5 15-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Simplify generation of swizzle for vector constructors
/external/mesa3d/src/glsl/ast_function.cpp
afb6fb9a92afaecbb0f8e9e65380c842667a4bd4 10-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Remove unnecessary "unused variable" warning suppression.

The "instructions" variable -is- used, so the cast to void can go away.
/external/mesa3d/src/glsl/ast_function.cpp
ba2382f50d7815947e17fe993b39feb573638d12 25-Oct-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Fix constant component count in vector constructor emitting.

Fixes freedesktop.org bug #31101 as well as piglit test cases
assignment-type-mismatch.vert and constructor-28.vert.
/external/mesa3d/src/glsl/ast_function.cpp
b39e6f33b60ef9bbaf81f320aaca6a440d8a6a8f 22-Sep-2010 Eric Anholt <eric@anholt.net> glsl: Rework assignments with write_masks to have LHS chan count match RHS.

It turns out that most people new to this IR are surprised when an
assignment to (say) 3 components on the LHS takes 4 components on the
RHS. It also makes for quite strange IR output:

(assign (constant bool (1)) (x) (var_ref color) (swiz x (var_ref v) ))
(assign (constant bool (1)) (y) (var_ref color) (swiz yy (var_ref v) ))
(assign (constant bool (1)) (z) (var_ref color) (swiz zzz (var_ref v) ))

But even worse, even we get it wrong, as shown by this line of our
current step(float, vec4):

(assign (constant bool (1)) (w)
(var_ref t)
(expression float b2f (expression bool >=
(swiz w (var_ref x))(var_ref edge))))

where we try to assign a float to the writemasked-out x channel and
don't supply anything for the actual w channel we're writing. Drivers
right now just get lucky since ir_to_mesa spams the float value across
all the source channels of a vec4.

Instead, the RHS will now have a number of components equal to the
number of components actually being written. Hopefully this confuses
everyone less, and it also makes codegen for a scalar target simpler.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_function.cpp
b4ec3f268c4a81c4b9047813423bdf49f0cb1cb5 01-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> ast_to_hir: Allow matrix-from-matrix constructors in GLSL ES.

Everything but 1.10 supports this, so just change the check to ==.
/external/mesa3d/src/glsl/ast_function.cpp
f32d3df8ab2b7c6c746f46870edc4b284cea50ca 02-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Apply implicit conversions to structure constructor parameters.

The code for handling implicit conversions should probably get
refactored, but for now, this is easy.

Fixes piglit test constructor-26.vert.
/external/mesa3d/src/glsl/ast_function.cpp
43a6200f3c3fb29d2e9654a293b2328cd6c0f64f 02-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Convert constant record constructor parameters to ir_constants.

I'm not sure if this is strictly necessary, but it seems wise.
/external/mesa3d/src/glsl/ast_function.cpp
cfe0dd5622a9b26e6df18801413ad8dc336f0c56 02-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Reject structure constructors that have too many arguments.

Fixes piglit test constructor-27.vert.
/external/mesa3d/src/glsl/ast_function.cpp
37200d83d3e61aa480e6dbb350e522bd0388644c 01-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Emit structure constructors inline

Fixes piglit test cases glsl-[fv]s-all-0[12].
/external/mesa3d/src/glsl/ast_function.cpp
39605587951aed546c14febcc26e5a479bf8d807 02-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Fix write mask in matrix-from-matrix constructors.

If the matrix being constructed was larger than the source matrix, it
would overwrite the lower-right part of the matrix with the wrong
values, rather than leaving it as the identity matrix.

For example, constructing a mat4 from a mat2 should only use a writemask
of "xy" when copying from the source, but was using "xyzw".

Fixes the code generated by piglit test constructor-23.vert.
/external/mesa3d/src/glsl/ast_function.cpp
1f7c7df40f830e164f96df4468a2b4fa365c4b84 02-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Move generate_constructor_(matrix|vector) to ir_constant ctor.
/external/mesa3d/src/glsl/ast_function.cpp
550237eedd772487151565f64384d35c1bf695a6 02-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> ast_function: Fix check for "too few components".

This was triggering even for matrix-from-matrix constructors. It is
perfectly legal to construct a mat3 from a mat2 - the rest will be
filled in by the identity matrix.

Changes piglit test constructor-23.vert from FAIL to PASS, but the
generated code is incorrect.
/external/mesa3d/src/glsl/ast_function.cpp
ee88c4664016b11359c391cc62296bcbfcc5decd 01-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> ast_function: Remove bogus cases from generate_constructor_matrix.

There are no integer matrix types, so switching on them is silly.
/external/mesa3d/src/glsl/ast_function.cpp
a6c3cd5ca6822da2ec6e869c7bc2b8ac64c177f2 31-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Write vector constructor constants in a single assignment

Make two passes over the constructor parameters. Write all of the
constants in a single write, then write the non-constants one at a
time. This causes the fragment shader

varying float g;
void main()
{
gl_FragColor = vec4(0.0, g, 0.0, 1.0);
}

to generate

(function main
(signature void (parameters )
(
(declare (temporary ) vec4 vec_ctor@0x8580058)
(assign (constant bool (1)) (xzw) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
(assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058) (swiz xxxx (var_ref g@0x8580218) ))
(assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0) (var_ref vec_ctor@0x8580058) )
))
)

instead of

(function main
(signature void (parameters )
(
(declare (temporary ) vec4 vec_ctor@0x8580058)
(assign (constant bool (1)) (x) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
(assign (constant bool (1)) (y) (var_ref vec_ctor@0x8580058) (swiz xxxx (var_ref g@0x8580218) ))
(assign (constant bool (1)) (z) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
(assign (constant bool (1)) (w) (var_ref vec_ctor@0x8580058) (constant vec4 (0.000000 0.000000 0.000000 1.000000)) )
(assign (constant bool (1)) (xyzw) (var_ref gl_FragColor@0x84d32a0) (var_ref vec_ctor@0x8580058) )
))
)

A similar optimization could be done for matrix constructors, but it
is a little more complicate there.
/external/mesa3d/src/glsl/ast_function.cpp
0c93e69b25559225d3124d5a0deaaeceabf8cb12 29-Aug-2010 Vinson Lee <vlee@vmware.com> glsl: Initialize data in ast_function_expression::hir.

Completely initialize data that is passed to ir_constant constructor.

Fixes piglit glsl-orangebook-ch06-bump valgrind uninitialized variable
error on softpipe and llvmpipe.
/external/mesa3d/src/glsl/ast_function.cpp
bfd7c9ac228c7ed8aec04c3b3aa33f40ee00b035 23-Aug-2010 Chia-I Wu <olv@lunarg.com> glsl: Include main/core.h.

Make glsl include only main/core.h from core mesa.
/external/mesa3d/src/glsl/ast_function.cpp
bdc0e5285a3d7d29b953970e43ca548cbc4e7e30 18-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Fix transpose of rows and cols

This error led to an assertion failure for some constructors of
non-square matrices. It only occured in matrices where the number of
columns was greater than the number of rows. It didn't even always
occur on those.

Fixes piglit glslparsertest case constructor-16.vert.
/external/mesa3d/src/glsl/ast_function.cpp
0dc39f481ab98d2114590103928b7403386c13cf 13-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Use MIN2 from macros.h instead of open coding it
/external/mesa3d/src/glsl/ast_function.cpp
1e0f0459e0ca8b9f0c67f8178e5189b8cfd6078c 06-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Log a better error message when a matching function cannot be found
/external/mesa3d/src/glsl/ast_function.cpp
3d58be6135e71e6105ae65850f2dbeaf9ecff5c3 04-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Generate masked assignments in vector and matrix constructors

Previously the in-line matrix and vector constructors would generate
swizzles in the LHS. The code is actually more clear if it just
generates the masked assignments instead of relying on the
ir_assignment constructor to convert the swizzles to write masks.
/external/mesa3d/src/glsl/ast_function.cpp
ad98aa9d93646600cc95b3e45a40eec26f18988a 04-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Remove uses of deprecated TALLOC_CTX type.
/external/mesa3d/src/glsl/ast_function.cpp
900ab2f564018856133c19b68713a6dfd206c184 03-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: No need to strdup the name passed in to ir_variable constructor.

ir_variable always strdups the incoming name so that it matches the
lifetime of the ir_variable.
/external/mesa3d/src/glsl/ast_function.cpp
62c4763b707e2227409f81b09dd5cf6e4410ea6a 29-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Fix spelling of "sentinel."
/external/mesa3d/src/glsl/ast_function.cpp
46d91615a2f6e1beaee98f40af957ba1a1a6b349 23-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> ast_function: Set constant_value on return value temporaries in 1.20+.
/external/mesa3d/src/glsl/ast_function.cpp
74e1802f5dd8921750851abc6128e4073602d405 20-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Extend ir_constant to store constant arrays, and generate them.

Since GLSL permits arrays of structures, we need to store each element
as an ir_constant*, not just ir_constant_data.

Fixes parser tests const-array-01.frag, const-array-03.frag,
const-array-04.frag, const-array-05.frag, though 03 and 04 generate the
wrong code.
/external/mesa3d/src/glsl/ast_function.cpp
13a19745d46d383fa7fc148ce129150ebde151b7 20-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Emit array constructors inline.
/external/mesa3d/src/glsl/ast_function.cpp
0048c7aef82b17c6bd160f49125a91a70cbf2b55 20-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Add some comments.
/external/mesa3d/src/glsl/ast_function.cpp
c7a18da69022d3f9b05c21ff2473e8ea390f77f1 20-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Replace insert_before/remove pairs with exec_node::replace_with.
/external/mesa3d/src/glsl/ast_function.cpp
f38d15b80d4e4c8ecb7a76087cdc49835f0aa271 21-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: glsl_type has its own talloc context, don't pass one in
/external/mesa3d/src/glsl/ast_function.cpp
7e2aa91507a5883e33473e0a94215ee3985baad1 20-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add and use new variable mode ir_var_temporary

This is quite a large patch because breaking it into smaller pieces
would result in the tree being intermitently broken. The big changes
are:

* Add the ir_var_temporary variable mode

* Change the ir_variable constructor to take the mode as a
parameter and correctly specify the mode for all ir_varables.

* Change the linker to not cross validate ir_var_temporary
variables.

* Change the linker to pull all ir_var_temporary variables from
global scope into 'main'.
/external/mesa3d/src/glsl/ast_function.cpp
02d3711a21f5766d286b09fbe1eda5d8520d151a 21-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Always insert function calls into the instruction stream.

If they have a return value, this means putting it into a temporary
and making a deref of the temp be the rvalue, since we don't know if
the rvalue will be used or not.
/external/mesa3d/src/glsl/ast_function.cpp
1f47245bdda2c85bf0f0174e6c24a50486b413aa 19-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Remove the const disease from function signature's callee.
/external/mesa3d/src/glsl/ast_function.cpp
17a307d154489d718ab51a6272d2054868d782f6 14-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> ast_function: Actually do type conversion on function arguments.
/external/mesa3d/src/glsl/ast_function.cpp
284d821206d74fddb346cd0d892d2dcec463e2a5 09-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> ast_function: Fix non-float constructors with matrix arguments.

Previously, code like ivec4(mat2(...)) would fail because the compiler
would naively try to convert a mat2 to an imat2...which doesn't exist.
Now, a separate pass breaks such matrices down to their columns, which
can be converted from vec2 to ivec2.

Fixes piglit tests constructor-11.vert, constructor-14.vert,
constructor-15.vert, and CorrectConstFolding2.frag.
/external/mesa3d/src/glsl/ast_function.cpp
f58bbd134e921b14f50ecd1e76b2943753ba194c 09-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> ast_function: Move error return earlier and don't indent the world.

This has no functional changes.
/external/mesa3d/src/glsl/ast_function.cpp
59df3385e1c413332c75be5d0e7751972d45430e 09-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> ast_function: Remove unnecessary check for empty constructors.

This case is already caught by a later check that ensures sufficient
components were provided, based on the type.
/external/mesa3d/src/glsl/ast_function.cpp
953ff1283d3d52e6a6b4850c2b0b574111625010 25-Jun-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Use _mesa_glsl_parse_state as the talloc parent, not glsl_shader.

_mesa_glsl_parse_state should be the parent for all temporary allocation
done while compiling a shader. glsl_shader should only be used as the
parent for the shader's final IR---the _result_ of compilation.

Since many IR instructions may be added or discarded during optimization
passes, IR should not ever be allocated to glsl_shader directly.

Done via sed -i s/talloc_parent(state)/state/g and s/talloc_parent(st)/st/g.

This also removes a ton of talloc_parent calls, which may help performance.
/external/mesa3d/src/glsl/ast_function.cpp
4b6feb0398458a69259e3b77d7a8573b926f2039 28-Jun-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Use talloc_strdup when generating constructor temporary names
/external/mesa3d/src/glsl/ast_function.cpp
699b247661b1c70e890e478dba88253cad035969 26-Jun-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Don't flatten constructor parameters to scalars

Now that all scalar, vector, and matrix constructors are emitted
in-line, the parameters to these constructors should not be flattened
to a pile of scalars. Instead, the functions that emit the in-line
constructor bodies can directly write the parameters to the correct
locations in the objects being constructed.
/external/mesa3d/src/glsl/ast_function.cpp
81c7e94466da19f9295b8eb5e4b5e587fea96284 26-Jun-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Always emit matrix constructors inline
/external/mesa3d/src/glsl/ast_function.cpp
c31dcdf57ed9646580040ebfe44c2609885fe96b 24-Jun-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Always emit vector constructors inline
/external/mesa3d/src/glsl/ast_function.cpp
26b5d33dce37755a6a4a799a9edfcdff8c5ce3e5 26-Jun-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Use i2b and f2b IR opcodes for casting int or float to bool
/external/mesa3d/src/glsl/ast_function.cpp
29285882676388aacff123e8bdf025904abf8ea9 25-Jun-2010 Eric Anholt <eric@anholt.net> glsl2: Move the compiler to the subdirectory it will live in in Mesa.
/external/mesa3d/src/glsl/ast_function.cpp