History log of /external/mesa3d/src/glsl/ast_to_hir.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
765221c0d5fdb0357bf6fae3220c7d57d93f938d 28-Nov-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Track UBO block names in the symbol table.

The GLSL 1.40 spec says:

"Uniform block names and variable names declared within uniform
blocks are scoped at the program level."

Track the block name in the symbol table and emit errors when conflicts
exist.

Fixes es3conform's uniform_buffer_object_block_name_conflict test, and
fixes the piglit block-name-clashes-with-{variable,function,struct}.vert
tests.

NOTE: This is a candidate for the 9.0 branch.

v2: Fix bad constructor initialization. Noticed by Topi Pohjolainen.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
(cherry picked from commit 4f29169913f99252c54e1922f6d164e2ef530a58)
/external/mesa3d/src/glsl/ast_to_hir.cpp
42ef3f68c9621eb713f154955dccabacd6e1e0ef 01-Sep-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Generate compile errors for explicit blend indices < 0 or > 1.

According to the GLSL 4.30 specification, this is a compile time error.
Earlier specifications don't specify a behavior, but since 0 and 1 are
the only valid indices for dual source blending, it makes sense to
generate the error.

Fixes (the fixed version of) piglit's layout-12.frag.

NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
(cherry picked from commit 354f2cb5c7330a7d43cf0b177daf758d2aa31e0a)
/external/mesa3d/src/glsl/ast_to_hir.cpp
86e0045578cd8d8be7736a8f56e2b51d61bda32a 23-Jul-2012 Eric Anholt <eric@anholt.net> glsl: Only flag RowMajor on matrix-type variables.

We were only propagating it to the API when the variable was a matrix type,
but we were still tripping over it in lower_ubo_reference when it was set on a
vector.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
b3c093c79c2ec49c36af37aa290d5ae452149f6e 27-Apr-2012 Eric Anholt <eric@anholt.net> glsl: Translate the AST for uniform blocks into some IR structures.

We're going to need this structure to cross-validate the uniform
blocks between shader stages, since unused ir_variables might get
dropped. It's also the place we store the RowMajor qualifier, which
is not part of the GLSL type (since that would cause a bunch of type
equality checks to fail).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
f7561e8ecd80e915150ca63c0c79a5f9839c8e12 27-Apr-2012 Eric Anholt <eric@anholt.net> glsl: Turn UBO variable declarations into ir_variables and check qualifiers.

Fixes piglit layout-*-non-uniform and layout-*-within-block.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
d43f4181e1633d2677a8d828abd4ffc1a7c1e493 06-Jun-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Remove open coded version of ir_variable::interpolation_string().

Presumably the function didn't exist when we wrote this code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
2d03f48a65a666ecdcfaffa3d39ad1b77f2b25b6 18-Apr-2012 Eric Anholt <eric@anholt.net> glsl: Add parsing for GLSL uniform blocks.

This doesn't do anything with the uniform block declarations yet, so
usage of those uniforms finds them to be undeclared.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
adfe53184155f33958f82383a7148b0536455a4c 19-May-2012 Ian Romanick <ian.d.romanick@intel.com> glsl: Remove spurious printf messages

These look like debug messages from the switch-statement development.

NOTE: This is a candidate for the 8.0 release branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
aa5ec137757323b424d0f2638c50c93b9b06ffff 14-May-2012 Eric Anholt <eric@anholt.net> glsl: Drop the extra NULL specifiction on ir_assignment constructors.

It's an implied argument, and I don't think being explicit about it
helps.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
9c4e9ce051bb43861adb4f8cd8e88a733c2f3ed1 14-May-2012 Eric Anholt <eric@anholt.net> glsl: Fix assertion failure on handling switch on uint expressions.

Fixes piglit glsl-1.30/execution/switch/fs-uint.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
bbbc7c7d566905920967f56648fc26abcb37f4a1 14-May-2012 Eric Anholt <eric@anholt.net> glsl: Reject non-scalar switch expressions.

The comment quotes spec saying that only scalar integers are allowed,
but we only checked for integer.

Fixes piglit switch-expression-const-ivec2.vert

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
5d6ea16dfe99e1aba61c25a897b66951faab1a39 14-May-2012 Eric Anholt <eric@anholt.net> glsl: Let the constructor figure out the types of switch-related expressions.

I noticed this while unindenting the code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
5462f3679ab7217d3a3be48365750801c7771237 14-May-2012 Eric Anholt <eric@anholt.net> glsl: Fix indentation of switch code.

I managed to completely trash it in 22d81f15.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
b2ee5a08bae6cdbbdafc1f1d9d6f3afbad2f7944 24-Apr-2012 Eric Anholt <eric@anholt.net> glsl: Don't consider unused FS out variables as being statically assigned.

I only considered var->assigned for FragColor and FragData, but
ignored when it was false for out vars. Fixes piglit
write-gl_FragColor-and-not-user-output.frag

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49068
/external/mesa3d/src/glsl/ast_to_hir.cpp
4b2a4cb7c2131c3c31e3d44a0d8838ef45f270e7 30-Mar-2012 Eric Anholt <eric@anholt.net> glsl: Properly throw compile-time errors for conflicting FS output writes.

We were checking for these at link time previously, which is not as
early as mandated, and would actually fail to detect conflicting
writes if dead code removal removed some writes.

Fixes failures in piglit
glsl-*/compiler/fragment-outputs/write-gl_Frag*

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
1256a5dcc86014d48bdc6fd10ea5a2fa11241667 24-Mar-2012 Dave Airlie <airlied@redhat.com> glsl: add support for ARB_blend_func_extended (v3)

This adds index support to the GLSL compiler.

I'm not 100% sure of my approach here, esp without how output ordering
happens wrt location, index pairs, in the "mark" function.

Since current hw doesn't ever have a location > 0 with an index > 0,
we don't have to work out if the output ordering the hw requires is
location, index, location, index or location, location, index, index.
But we have no hw to know, so punt on it for now.

v2: index requires layout - catch and error
setup explicit index properly.

v3: drop idx_offset stuff, assume index follow location

Signed-off-by: Dave Airlie <airlied@redhat.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
eb7a71dea78152142b456f29e4881c4d3aeb56b6 30-Mar-2012 Eric Anholt <eric@anholt.net> glsl: Drop the round-trip through ast_type_specifier for many builtin types.

We have lexer recognition of a bunch of our types based on the
handling. This code was mapping those recognized tokens to an enum
and then to a string of their name. Just drop the enums and provide
the string directly in the parser.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
dca19a771156685895892740f687cee7cf84a8c9 13-Mar-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Explicitly NULL-check variables before making a dereference.

The constructor currently returns a ir_dereference_variable of error
type when provided NULL, but that's about to change in the next commit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ast_to_hir.cpp
ead3589aa2810b66164178a1d55d2063cfa3b041 08-Feb-2012 Eric Anholt <eric@anholt.net> glsl: Avoid extra if statements for logic and/or with no side effects.

This avoids extra if statements in the common case of just comparing
two expressions that don't involve assignments or function calls,
along with simplifying the handling of constant expressions. Reduces
i965 instructions generated in unigine tropics and sanctuary,
yofrankie, warsow, gstreamer shaders, and the weston compositor.

shader-db results:
Total instructions: 213052 -> 212752
38/1246 programs affected (3.0%)
14309 -> 14009 instructions in affected programs (2.1% reduction)
/external/mesa3d/src/glsl/ast_to_hir.cpp
57e44371a5b6aa8122b6a482ed6bd33e797ea1d2 30-Jan-2012 Eric Anholt <eric@anholt.net> glsl: Add error case for switch() with two default cases.

Fixes piglit switch-case-duplicated.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
140632190cf41e6a035ca199b181091d4ed46986 30-Jan-2012 Eric Anholt <eric@anholt.net> glsl: Throw an error when faced with a duplicated switch() case label.

The error message I chose matches gcc's error. Fixes piglit
switch-case-duplicated.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
2c3e10e71935506798c413363df27afc4348fb53 28-Jan-2012 Eric Anholt <eric@anholt.net> glsl: Throw the required error when a case label is a non-constant.

It's not quite spelled out in the spec text, but the grammar indicates
that only constant values are allowed as switch() case labels (and
only constant values make sense, anyway).

Fixes piglit glsl-1.30/compiler/switch-statement/switch-case-uniform-int.vert.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
22d81f154fed9e004cca91807808ae3b81b01ced 28-Jan-2012 Eric Anholt <eric@anholt.net> glsl: Save and restore the whole switch state for nesting.

This stuffs them all in a struct for sanity. Fixes piglit
glsl-1.30/execution/switch/fs-uniform-nested.

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
916e206ef0cbcc5fa6c4026135e92079e1d73ec2 10-Jan-2012 Eric Anholt <eric@anholt.net> glsl: Add error checking for applying interpolation qualifiers to other vars.

Fixes piglit
glsl-1.30/compiler/interpolation-qualifiers/local-smooth-01.frag.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
1f125374e73d1718cd54c946826c76b09998c055 23-Dec-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Don't mark assignment temporaries as read-only

The various l-value errors this was designed to catch are now caught
by other means. Marking the temporaries as read-only now just
prevents sensible error messages from being generated. It's

0:0(0): error: function parameter 'out p' references the read-only variable '_post_incdec_tmp'

versus

0:13(5): error: function parameter 'out p' references a post-decrement operation

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
e9015e99d0d702570dbd3d7bcbafbf6c723cb7a7 23-Dec-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Emit errors for assignments to non-l-value expressions

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_to_hir.cpp
fa0a9ac5cdf49865cfc289c4326c73c9dd4a61c5 23-Dec-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Track descriptions of some expressions that can't be l-values

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
39464489510270bbe472d11f7614c04ce1b6ae33 24-Dec-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Don't use base type for bit-not when there's an error

Other parts of the compiler assume that expressions will have
well-formed types or the error type. Just using the type of the thing
being operated on can cause expressions like ~3.14 or ~false to not
have a well-formed type. This could then result in an assertion
failure in the context epxression handler.

If there is an error processing the expression, set the type of the IR
expression to error.

Fixes piglit's bit-not-0[789].frag tests.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42755
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: Vinson Lee <vlee@vmware.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
6b43d6fdda13d73ca7b059f986ce2a2046bf03a0 19-Nov-2011 Marek Olšák <maraeo@gmail.com> glsl: finish up ARB_conservative_depth (v2)

v2: updated an error message

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
5c02e2e2de75b9d18ca25b4f1cba38c4a89c5bd0 08-Nov-2011 Dan McCabe <zen3d.linux@gmail.com> glsl: Generate IR for switch statements

Up until now modifying the GLSL compiler has been pretty straightforward.
This is where things get interesting. But still pretty straightforward.

Switch statements can be thought of a series of if/then/else statements.
Case labels are compared with the value of a test expression and the case
statements are executed if the comparison is true.

There are a couple of aspects of switch statements that complicate this simple
view of the world. The primary one is that cases can fall through sequentially
to subsequent case, unless a break statement is encountered, in which case,
the switch statement exits completely.

But break handling is further complicated by the fact that a break statement
can impact the exit of a loop. Thus, we need to coordinate break processing
between switch statements and loop statements.

The code generated by a switch statement maintains three temporary state
variables:
int test_value;
bool is_fallthru;
bool is_break;

test_value is initialized to the value of the test expression at the head of
the switch statement. This is the value that case labels are compared against.

is_fallthru is used to sequentially fall through to subsequent cases and is
initialized to false. When a case label matches the test expression, this
state variable is set to true. It will also be forced to false if a break
statement has been encountered. This forcing to false on break MUST be
after every case test. In practice, we defer that forcing to immediately after
the last case comparison prior to executing a case statement, but that is
an optimization.

is_break is used to indicate that a break statement has been executed and is
initialized to false. When a break statement is encountered, it is set to true.
This state variable is then used to conditionally force is_fallthru to to false
to prevent subsequent case statements from executing.

Code generation for break statements depends on whether the break statement is
inside a switch statement or inside a loop statement. If it inside a loop
statement is inside a break statement, the same code as before gets generated.
But if a switch statement is inside a loop statement, code is emitted to set
the is_break state to true.

Just as ASTs for loop statements are managed in a stack-like
manner to handle nesting, we also add a bool to capture the innermost switch
or loop condition. Note that we still need to maintain a loop AST stack to
properly handle for-loop code generation on a continue statement. Technically,
we don't (yet) need a switch AST stack, but I am using one for orthogonality
with loop statements, in anticipation of future use. Note that a simple
boolean stack would have sufficed.

We will illustrate a switch statement with its analogous conditional code that
a switch statement corresponds to by examining an example.

Consider the following switch statement:
switch (42) {
case 0:
case 1:
gl_FragColor = vec4(1.0, 2.0, 3.0, 4.0);
case 2:
case 3:
gl_FragColor = vec4(4.0, 3.0, 2.0, 1.0);
break;
case 4:
default:
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
}

Note that case 0 and case 1 fall through to cases 2 and 3 if they occur.

Note that case 4 and the default case must be reached explicitly, since cases
2 and 3 break at the end of their case.

Finally, note that case 4 and the default case don't break but simply fall
through to the end of the switch.

For this code, the equivalent code can be expressed as:
int test_val = 42; // capture value of test expression
bool is_fallthru = false; // prevent initial fall through
bool is_break = false; // capture the execution of a break stmt

is_fallthru |= (test_val == 0); // enable fallthru on case 0
is_fallthru |= (test_val == 1); // enable fallthru on case 1
is_fallthru &= !is_break; // inhibit fallthru on previous break
if (is_fallthru) {
gl_FragColor = vec4(1.0, 2.0, 3.0, 4.0);
}

is_fallthru |= (test_val == 2); // enable fallthru on case 2
is_fallthru |= (test_val == 3); // enable fallthru on case 3
is_fallthru &= !is_break; // inhibit fallthru on previous break
if (is_fallthru) {
gl_FragColor = vec4(4.0, 3.0, 2.0, 1.0);
is_break = true; // inhibit all subsequent fallthru for break
}

is_fallthru |= (test_val == 4); // enable fallthru on case 4
is_fallthru = true; // enable fallthru for default case
is_fallthru &= !is_break; // inhibit fallthru on previous break
if (is_fallthru) {
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
}

The code generate for |= and &= uses the conditional assignment capabilities
of the IR.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
85beb39e14556cf02f58116fd287120cd1defbd5 08-Nov-2011 Dan McCabe <zen3d.linux@gmail.com> glsl: Reference data structure ctors in grammar

We now tie the grammar to the ctors of the ASTs they reference.

This requires that we actually have definitions of the ctors.

In addition, we also need to define "print" and "hir" methods for the AST
classes. The Print methods are pretty simple to flesh out. However, at this
stage of the development, we simply stub out the "hir" methods and flesh
them out later.

Also, since actual class instances get returned by the productions in the
grammar, we also need to designate the type of the productions that
reference those instances.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
f37b1ad937dd2c420f4c9fd9aa5887942bd31f3f 31-Oct-2011 Ian Romanick <ian.d.romanick@intel.com> linker: Check that initializers for global variables match

This requires tracking a couple extra fields in ir_variable:

* A flag to indicate that a variable had an initializer.

* For non-const variables, a field to track the constant value of the
variable's initializer.

For variables non-constant initalizers, ir_variable::has_initializer
will be true, but ir_variable::constant_initializer will be NULL. The
linker can use the values of these fields to check adherence to the
GLSL 4.20 rules for shared global variables:

"If a shared global has multiple initializers, the initializers
must all be constant expressions, and they must all have the same
value. Otherwise, a link error will result. (A shared global
having only one initializer does not require that initializer to
be a constant expression.)"

Previous to 4.20 the GLSL spec simply said that initializers must have
the same value. In this case of non-constant initializers, this was
impossible to determine. As a result, no vendor actually implemented
that behavior. The 4.20 behavior matches the behavior of NVIDIA's
shipping implementations.

NOTE: This is candidate for the 7.11 branch. This patch also needs
the preceding patch "glsl: Refactor generate_ARB_draw_buffers_variables
to use add_builtin_constant"

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34687
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
9abda92b270596fd3a5e2e8b74e3fc3255da70ce 01-Nov-2011 Paul Berry <stereotype441@gmail.com> glsl: Fix type mismatch when incrementing or decrementing uint.

When converting an expression like "++x" to GLSL IR we were failing to
account for the possibility that x might be an unsigned integral type.
As a result the user would receive a bogus error message "Could not
implicitly convert operands to arithmetic operator".

Fixes piglit tests {vs,fs}-{increment,decrement}-uint.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
f5ba4d055ee27bfd741ad019e3b3d4b1a1ce9bd9 26-Oct-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Clean-up spurious error message on bad structure definitions

Previously a shader like

int X;
struct X { int i; };

void main() { gl_Position = vec4(0.0); }

would generate two error message:

0:2(19): error: struct `X' previously defined
0:2(20): error: incomplete declaration

The first one is the real error, and the second is spurious.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
a04211ecb8c907eaef69832abc2e16cd6f9887a0 24-Oct-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Generate an error for array-of-array declarations

Other parts of the code already caught things like 'float x[4][2]'.
However, nothing caught 'float [4] x[2]'.

Fixes piglit test array-multidimensional-new-syntax.vert.

NOTE: This is candidate for the 7.11 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
c488150dea083a9677429b4185c6b20d7facd52b 21-Oct-2011 Paul Berry <stereotype441@gmail.com> glsl: Distinguish between no interpolation qualifier and 'smooth'

Previously, we treated the 'smooth' qualifier as equivalent to no
qualifier at all. However, this is incorrect for the built-in color
variables (gl_FrontColor, gl_BackColor, gl_FrontSecondaryColor, and
gl_BackSecondaryColor). For those variables, if there is no qualifier
at all, interpolation should be flat if the shade model is GL_FLAT,
and smooth if the shade model is GL_SMOOTH.

To make this possible, I added a new value to the
glsl_interp_qualifier enum, INTERP_QUALIFIER_NONE.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ast_to_hir.cpp
cf45949d6a896651a5f3864d3b195e26d59eee74 26-Oct-2011 Paul Berry <stereotype441@gmail.com> mesa: Expose GLSL interpolation qualifiers in gl_fragment_program.

This patch makes GLSL interpolation qualifiers visible to drivers via
the array InterpQualifier[] in gl_fragment_program, so that they can
easily be used by driver back-ends to select the correct interpolation
mode.

Previous to this patch, the GLSL compiler was using the enum
ir_variable_interpolation to represent interpolation types. Rather
than make a duplicate enum in core mesa to represent the same thing, I
moved the enum into mtypes.h and renamed it to be more consistent with
the other enums defined there.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ast_to_hir.cpp
c475a54578bf5473c6c62bc5468ef4fe555164d7 07-Oct-2011 Jason Wood <sandain@hotmail.com> glsl: Remove version check when looking for identifiers containing "__".

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
684b701c124cf258ba9012adf51357e072ae61f9 04-Oct-2011 Eric Anholt <eric@anholt.net> glsl: Consider "__" in identifers as reserved.

Fixes double-underscore-*.frag.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
00792e3586746c833ffc9bb65712e38038916e06 10-Sep-2011 Paul Berry <stereotype441@gmail.com> glsl: Remove field array_lvalue from ir_variable.

The array_lvalue field was attempting to enforce the restriction that
whole arrays can't be used on the left-hand side of an assignment in
GLSL 1.10 or GLSL ES, and can't be used as out or inout parameters in
GLSL 1.10.

However, it was buggy (it didn't work properly for built-in arrays),
and it was clumsy (it unnecessarily kept track on a
variable-by-variable basis, and it didn't cover the GLSL ES case).

This patch removes the array_lvalue field completely in favor of
explicit checks in ast_parameter_declarator::hir() (this check is
added) and in do_assignment (this check was already present).

This causes a benign behavioral change: when the user attempts to pass
an array as an out or inout parameter of a function in GLSL 1.10, the
error is now flagged at the time the function definition is
encountered, rather than at the time of invocation. Previously we
allowed such functions to be defined, and only flagged the error if
they were invoked.

Fixes Piglit tests
spec/glsl-1.10/compiler/qualifiers/fn-{out,inout}-array-prohibited*
and
spec/glsl-1.20/compiler/assignment-operators/assign-builtin-array-allowed.vert.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
9a3bd5e0452c9c791ba94155d3c9ddba42abd114 29-Aug-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Silence several "warning: unused parameter"
/external/mesa3d/src/glsl/ast_to_hir.cpp
525cec98a5c65c27c62fed0cff706bca50bf8c6e 07-Sep-2011 Eric Anholt <eric@anholt.net> glsl: Clarify error message about whole-array assignment in GLSL 1.10.

Previously, it would produce:

Failed to compile FS: 0:6(7): error: non-lvalue in assignment

and now it produces:

Failed to compile FS: 0:5(7): error: whole array assignment is not
allowed in GLSL 1.10 or GLSL ES 1.00.

Also, add spec quotation to the two places we have code for array
lvalues in GLSL 1.10.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
407a1001aefcb15e8d066031417d91ea22f1daf1 07-Sep-2011 Eric Anholt <eric@anholt.net> glsl: When assiging from a whole array, mark it as used.

Fixes piglit link-uniform-array-size.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
37bb1c4de2eb2fa80d09b6e8dc8f39814d790e09 12-Aug-2011 Paul Berry <stereotype441@gmail.com> glsl: Check that gl_ClipDistance[] is not sized too large.

Fixes piglit tests
clip-distance-explicit-too-large-with-access.{frag,vert} and
clip-distance-explicit-too-large.{frag,vert}.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
93b9758d01e2542ec3c2b8672cca0ae19b257aac 06-Sep-2011 Paul Berry <stereotype441@gmail.com> glsl: Rework oversize array check for gl_TexCoord.

The check now applies both when explicitly declaring the size of
gl_TexCoord and when implicitly setting the size of gl_TexCoord by
accessing it using integral constant expressions.

This is prep work for adding similar size checks to gl_ClipDistance.

Fixes piglit tests texcoord/implicit-access-max.{frag,vert}.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
a313c29c777de0bc74c252f1d35eef7d3d907e1f 06-Aug-2011 Eric Anholt <eric@anholt.net> glsl: When assigning to a whole array, mark the array as accessed.

The vs-varying-array-mat2-col-row-wr test writes a mat2[3] constant to
a mat2[3] varying out array, and also statically accesses element 1 of
it on the VS and FS sides. At link time it would get trimmed down to
just 2 elements, and then codegen of the VS would end up generating
assignments to the unallocated last entry of the array. On the new
i965 VS backend, that happened to land on the vertex position.

Some issues remain in this test on softpipe, i965/old-vs and
i965/new-vs on visual inspection, but i965 is passing because only one
green pixel is probed, not the whole split green/red quad.
/external/mesa3d/src/glsl/ast_to_hir.cpp
d4144a123b603d3c33cb356cf3c8e5ae4653594e 02-Aug-2011 Paul Berry <stereotype441@gmail.com> glsl: Check array size is const before asserting that no IR was generated.

process_array_type() contains an assertion to verify that no IR
instructions are generated while processing the expression that
specifies the size of the array. This assertion needs to happen
_after_ checking whether the expression is constant. Otherwise we may
crash on an illegal shader rather than reporting an error.

Fixes piglit tests array-size-non-builtin-function.vert and
array-size-with-side-effect.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
547212d963c70161915c46d64e8020617199fb8d 03-Aug-2011 Chia-I Wu <olv@lunarg.com> glsl: empty declarations should be valid

Unlike C++, empty declarations such as

float;

should be valid. The spec is not explicit about this actually.

Some apps that generate their shader sources may rely on this. This was
noted when porting one of them to Linux from Windows.

Reviewed-by: Chad Versace <chad@chad-versace.us>

Note: this is a candidate for the 7.11 branch.
/external/mesa3d/src/glsl/ast_to_hir.cpp
02c5ae1b3fef75d5c0a715313a69e6b95ebd5b95 11-Jul-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Reject shaders that contain static recursion

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 <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
f07221056e1822187546b76387714b3172f9b2c5 12-Jul-2011 Paul Berry <stereotype441@gmail.com> glsl: Ensure that sampler declarations are always uniform or "in" parameters.

This brings us into compliance with page 17 (page 22 of the PDF) of
the GLSL 1.20 spec:

"[Sampler types] can only be declared as function parameters or
uniform variables (see Section 4.3.5 "Uniform"). ... [Samplers]
cannot be used as out or inout function parameters."

The spec isn't explicit about whether this rule applies to
structs/arrays containing shaders, but the intent seems to be to
ensure that it can always be determined at compile time which sampler
is being used in each texture lookup. So to avoid creating a
loophole, the rule needs to apply to structs/arrays containing shaders
as well.

Fixes piglit tests spec/glsl-1.10/compiler/samplers/*.frag, and fixes
bug 38987.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38987
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
8eb975394478a5c1ebd2bd8a12b5eb61cef808a7 15-Jun-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Distinguish "type mismatch" error messages for modulus operator.

Previously, it would simply say "type error" in three different cases:
- The LHS is not an integer
- The RHS is not an integer
- The LHS and RHS have different base types (int vs. uint)

Now the error messages state the specific problem.

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_to_hir.cpp
b078aad8ab22d840456688480a8c27d4664297ce 28-Jun-2011 Paul Berry <stereotype441@gmail.com> glsl: permit explicit locations on fragment shader outputs, not inputs

From the OpenGL docs for GL_ARB_explicit_attrib_location:

This extension provides a method to pre-assign attribute locations to
named vertex shader inputs and color numbers to named fragment shader
outputs.

This was accidentally implemented for fragment shader inputs. This
patch fixes it to apply to fragment shader outputs.

Fixes piglit tests
spec/ARB_explicit_attrib_location/1.{10,20}/compiler/layout-{01,03,06,07,08,09,10}.frag

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38624
/external/mesa3d/src/glsl/ast_to_hir.cpp
08ba9778dbf3326bdfc8ca8035b51412032748ea 15-Apr-2011 Kenneth Graunke <kenneth@whitecape.org> glsl/ast_to_hir: Only use the local 'type' variable as a temporary.

Lots of code (deleted by this patch) tried to make type == result->type,
but not all cases did. Don't pretend; just use result->type.

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_to_hir.cpp
3d5cfcfed16c5a79bdf67027afe4ea8058b899cb 11-Apr-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Emit a warning when the left-hand operand of a comma has no effect

The expression

x = y, 5, 3;

will generate

0:7(9): warning: left-hand operand of comma expression has no effect

The warning is only emitted for the left-hand operands, becuase the
right-most operand is the result of the expression. This could be
used in an assignment, etc.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ast_to_hir.cpp
756c262756b2434efeb2c2a33a180fda0757a6e5 10-Apr-2011 Eric Anholt <eric@anholt.net> glsl: Perform type checking on "^^" operands.

We were letting any old operand through, which generally resulted in
assertion failures later.

Fixes array-logical-xor.vert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
175829f1a8ab0df7594131cc569462e45c1974ec 09-Apr-2011 Eric Anholt <eric@anholt.net> glsl: When we've emitted a semantic error for ==, return a bool constant.

This prevents later errors (including an assertion failure) from
cascading the failure.

Fixes invalid-equality-04.vert.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33303
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
9e04b190b5f59c5b375645f5756a6edd98a7f90c 09-Apr-2011 Eric Anholt <eric@anholt.net> glsl: Semantically check the RHS of `||' even when short-circuiting.

We just do the AST-to-HIR processing, and only push the instructions
if needed in the constant false case.

Fixes glslparsertest/glsl2/logic-02.frag

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
7ec0c9789669ac88fcdd66c562e6d58281b477ce 09-Apr-2011 Eric Anholt <eric@anholt.net> glsl: Semantically check the RHS of `&&' even when short-circuiting.

We just do the AST-to-HIR processing, and only push the instructions
if needed in the constant true case.

Fixes glslparsertest/glsl2/logic-01.frag

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
01822706ec2c2501a2cd2431a90c56b334b79a5c 10-Apr-2011 Eric Anholt <eric@anholt.net> glsl: Avoid cascading errors when looking for a scalar boolean and failing.

By always using a boolean, we should generally avoid further
complaints. The failure case I see is logic_not, where the user might
understandably make the mistake of using `!' on a boolean vector (like
a piglit case did recently!), and then get a further complaint that
the new boolean type doesn't match the bvec it gets assigned to.

Fixes invalid-logic-not-06.vert (assertion failure when the bad type
ends up in an expression and ir_constant_expression gets angry).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33314
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
8752824f27c979986ae855667337e89637b005fb 27-Mar-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Accept precision qualifiers on sampler types, but only in ES.

GLSL 1.30 states clearly that only float and int are allowed, while the
GLSL ES specification's issues section states that sampler types may
take precision qualifiers.

Fixes compilation failures in 3DMarkMobileES 2.0 and GLBenchmark 2.0.

NOTE: This is a candidate for stable release branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
0d9d036004f135c38990c60f46074b70cff6e663 25-Mar-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Fix off-by-one error setting max_array_access for non-constant indexing

NOTE: This is a candidate for the stable branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
85caea29c18fad89050ac366c558afef568dcb3f 16-Mar-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Only allow unsized array assignment in an initializer

It should have been a tip when the spec says "However, implicitly
sized arrays cannot be assigned to. Note, this is a rare case that
*initializers and assignments appear to have different semantics*."
(empahsis mine)

Fixes bugzilla #34367.

NOTE: This is a candidate for stable release branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
09a4ba0fc31fa8fc193dfb7b4fd78e32722b8312 05-Mar-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Process redeclarations before initializers

If an array redeclaration includes an initializer, the initializer
would previously be dropped on the floor. Instead, directly apply the
initializer to the correct ir_variable instance and append the
generated instructions.

Fixes bugzilla #34374 and piglit tests glsl-{vs,fs}-array-redeclaration.

NOTE: This is a candidate for stable release branches. 0292ffb8 and
8e6cb9fe are also necessary.
/external/mesa3d/src/glsl/ast_to_hir.cpp
0292ffb85c03e9fa15b9395e3875109dd8979292 05-Mar-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Refactor AST-to-HIR code handling variable initializers
/external/mesa3d/src/glsl/ast_to_hir.cpp
8e6cb9fe51a2237e51b47198eb7d46b14ad288b5 05-Mar-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Refactor AST-to-HIR code handling variable redeclarations
/external/mesa3d/src/glsl/ast_to_hir.cpp
eb639349e289a6b8be06a54f5e9e0ce18c71d511 27-Feb-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Use reralloc instead of plain realloc.

Plugs a memory leak when compiling shaders with user defined structures.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
82f994f3860ca05ff5550f32844b0f523d40b9ef 04-Feb-2011 Chad Versace <chad.versace@intel.com> glsl: Set operators '%' and '%=' to be reserved when GLSL < 1.30

From section 5.9 of the GLSL 1.20 spec:
The operator modulus (%) is reserved for future use.

From section 5.8 of the GLSL 1.20 spec:
The assignments modulus into (%=), left shift by (<<=), right shift by
(>>=), inclusive or into ( |=), and exclusive or into ( ^=). These
operators are reserved for future use.

The GLSL ES 1.00 spec and GLSL 1.10 spec have similiar language.

Fixes bug:
https://bugs.freedesktop.org//show_bug.cgi?id=33916

Fixes Piglit tests:
spec/glsl-1.00/compiler/arithmetic-operators/modulus-00.frag
spec/glsl-1.00/compiler/assignment-operators/modulus-assign-00.frag
spec/glsl-1.10/compiler/arithmetic-operators/modulus-00.frag
spec/glsl-1.10/compiler/assignment-operators/modulus-assign-00.frag
spec/glsl-1.20/compiler/arithmetic-operators/modulus-00.frag
spec/glsl-1.20/compiler/assignment-operators/modulus-assign-00.frag
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
bc04d244f5a86fd7085e3d648949413e2d2ec797 27-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Propagate depth layout qualifier from AST to IR
/external/mesa3d/src/glsl/ast_to_hir.cpp
2db46fe5f0145a6afff5b8edc2f00b8c734bb640 23-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Don't assert when the value returned by a function has no rvalue

The rvalue of the returned value can be NULL if the shader says
'return foo();' and foo() is a function that returns void.

Existing GLSL specs do *NOT* say that this is an error. The type of
the return value is void. If the return type of the function is also
void, then this should compile without error. I expect that future
versions of the GLSL spec will fix this (wink, wink, nudge, nudge).

Fixes piglit test glsl-1.10/compiler/expressions/return-01.vert and
bugzilla #33308.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
01a584d09350d2c726312e2c9e88c5dbc54bdb70 20-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Mark 'in' variables at global scope as read-only

Fixes Piglit tests:
spec/glsl-1.30/compiler/storage-qualifiers/static-write-centroid-in-01.frag
spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-01.frag
spec/glsl-1.30/compiler/storage-qualifiers/static-write-in-02.frag
/external/mesa3d/src/glsl/ast_to_hir.cpp
46f7105df487c91569f7e4a8da74d673c12e5619 19-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Fix segfault due to missing printf argument

Fixes the following Piglit tests:
glslparsertest/shaders/array2.frag
glslparsertest/shaders/dataType6.frag

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
45e8e6c6b1b7f3bc00a578fa6809c9bc719c171a 18-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Fix semantic checks on precision qualifiers

The check for
Precision qualifiers only apply to floating point and integer types.
was incomplete. It rejected only type 'bool' and structures.
/external/mesa3d/src/glsl/ast_to_hir.cpp
08a286c9cc8fecb081057e0f551c88a446c47b6f 17-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Add support for default precision statements

* Add new field ast_type_specifier::is_precision_statement.
* Add semantic checks in ast_type_specifier::hir().
* Alter parser rules accordingly.
/external/mesa3d/src/glsl/ast_to_hir.cpp
889e1a5b6c6602198d649ea5881e0010dec575e9 17-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Add semantic checks for precision qualifiers

* Check that precision qualifiers only appear in language versions 1.00,
1.30, and later.
* Check that precision qualifiers do not apply to bools and structs.

Fixes the following Piglit tests:
* spec/glsl-1.30/precision-qualifiers/precision-bool-01.frag
* spec/glsl-1.30/precision-qualifiers/precision-struct-01.frag
* spec/glsl-1.30/precision-qualifiers/precision-struct-02.frag
/external/mesa3d/src/glsl/ast_to_hir.cpp
1eb0f17fa4aa548779cb7d8ffbd86de3523d6796 12-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Check that 'centroid in' does not occur in vertex shader

The check is performed only in GLSL versions >= 1.30.

From section 4.3.4 of the GLSL 1.30 spec:
"It is an error to use centroid in in a vertex shader."

Fixes Piglit test
spec/glsl-1.30/compiler/storage-qualifiers/vs-centroid-in-01.vert
/external/mesa3d/src/glsl/ast_to_hir.cpp
8faaa4a672c1062e486eda2525287715b554342d 12-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Check that interpolation quals only apply to vertex ins and fragment outs

The check is performed only in GLSL versions >= 1.30.

Fixes the following Piglit tests:
* spec/glsl-1.30/compiler/interpolation-qualifiers/fs-smooth-02.frag
* spec/glsl-1.30/compiler/interpolation-qualifiers/vs-smooth-01.vert
/external/mesa3d/src/glsl/ast_to_hir.cpp
605aacc67d73db0926e0046a90a07fcd93a2d613 12-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Check that interpolation qualifiers do not precede 'varying'

... and 'centroid varying'. The check is performed only in GLSL
versions >= 1.30.

From page 29 (page 35 of the PDF) of the GLSL 1.30 spec:
"interpolation qualifiers may only precede the qualifiers in, centroid
in, out, or centroid out in a declaration. They do not apply to the
deprecated storage qualifiers varying or centroid varying."

Fixes Piglit test
spec/glsl-1.30/compiler/interpolation-qualifiers/smooth-varying-01.frag.
/external/mesa3d/src/glsl/ast_to_hir.cpp
4bcff0c19091c7df2b2e0bafe58addb5bae28f1a 08-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Emit errors or warnings when 'layout' is used with 'attribute' or 'varying'

The specs that add 'layout' require the use of 'in' or 'out'.
However, a number of implementations, including Mesa, shipped several
of these extensions allowing the use of 'varying' and 'attribute'.
For these extensions only a warning is emitted.

This differs from the behavior of Mesa 7.10. Mesa 7.10 would only
accept 'attribute' with 'layout(location)'. This behavior was clearly
wrong. Rather than carrying the broken behavior forward, we're just
doing the correct thing.

This is related to (piglit) bugzilla #31804.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
82c4b4f88af97395a3d1b01e1998ec828cd5d305 08-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Allow 'in' and 'out' when 'layout' is also available

All of the extensions that add the 'layout' keyword also enable (and
required) the use of 'in' and 'out' with shader globals.

This is related to (piglit) bugzilla #31804.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
bd33055ef4b6dd18d6247ff7d9e47496ff4acc51 08-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Track variable usage, use that to enforce semantics

In particular, variables cannot be redeclared invariant after being
used.

Fixes piglit test invariant-05.vert and bugzilla #29164.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
469ea695bbbc984ebec26b2413ab70d450a283ca 08-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Disallow 'in' and 'out' on globals in GLSL 1.20

Fixes piglit tests glsl-1.20/compiler/qualifiers/in-01.vert and
glsl-1.20/compiler/qualifiers/out-01.vert and bugzilla #32910.

NOTE: This is a candidate for the 7.9 and 7.10 branches. This patch
also depends on the previous two commits.
/external/mesa3d/src/glsl/ast_to_hir.cpp
86b4398cd158024f6be9fa830554a11c2a7ebe0c 06-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Support the 'invariant(all)' pragma

Previously the 'STDGL invariant(all)' pragma added in GLSL 1.20 was
simply ignored by the compiler. This adds support for setting all
variable invariant.

In GLSL 1.10 and GLSL ES 1.00 the pragma is ignored, per the specs,
but a warning is generated.

Fixes piglit test glsl-invariant-pragma and bugzilla #31925.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
/external/mesa3d/src/glsl/ast_to_hir.cpp
e942f328365309a1d8240cfe8eb5d88391015f37 05-Jan-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Allow less restrictive uses of sampler array indexing in GLSL <= 1.20

GLSL 1.10 and 1.20 allow any sort of sampler array indexing.
Restrictions were added in GLSL 1.30. Commit f0f2ec4d added support
for the 1.30 restrictions, but it broke some valid 1.10/1.20 shaders.
This changes the error to a warning in GLSL 1.10, GLSL 1.20, and GLSL
ES 1.00.

There are some spurious whitespace changes in this commit. I changed
the layout (and wording) of the error message so that all three cases
would be similar. The 1.10/1.20 and 1.30 text is the same. The only
difference is that one is an error, and the other is a warning. The
GLSL ES 1.00 wording is similar but not quite the same.

Fixes piglit test
spec/glsl-1.10/compiler/constant-expressions/sampler-array-index-02.frag
and bugzilla #32374.
/external/mesa3d/src/glsl/ast_to_hir.cpp
68d06b1454aea30c492c7318ab4e8514df8f38fd 16-Dec-2010 Chad Versace <chad.versace@intel.com> glsl: Check that integer vertex outputs are qualified with flat

Perform this check in ast_declarator_list::hir().

From section 4.3.6 of the GLSL 1.30 spec:
"If a vertex output is a signed or unsigned integer or integer
vector, then it must be qualified with the interpolation
qualifier
flat."
/external/mesa3d/src/glsl/ast_to_hir.cpp
b84e3f570f4b5aba1dd96760e090ae976d0e1cba 16-Dec-2010 Chad Versace <chad.versace@intel.com> glsl: Allow redeclaration of gl_Color and its variants in GLSL 1.30

Allow redeclaration of the following built-in variables with an
interpolation qualifier in language versions >= 1.30:
* gl_FrontColor
* gl_BackColor
* gl_FrontSecondaryColor
* gl_BackSecondaryColor
* gl_Color
* gl_SecondaryColor

See section 4.3.7 of the GLSL 1.30 spec.
/external/mesa3d/src/glsl/ast_to_hir.cpp
81168351a7f493fcde55e621af046c9301aa93e9 01-Jan-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Remove unused "instructions" parameter.

I think was used long ago, when we actually read the builtins into the
shader's instruction stream directly, rather than creating a separate
shader and linking the two. It doesn't seem to serve any purpose now.
/external/mesa3d/src/glsl/ast_to_hir.cpp
d7f27e2e76eac9bc2ee0fa36f52542fdcb9563dd 11-Dec-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Inherrit type of declared variable from initializer after processing assignment

do_assignment may apply implicit conversions to coerce the base type
of initializer to the base type of the variable being declared. Fixes
piglit test glsl-implicit-conversion-02 (bugzilla #32287). This
probably also fixes bugzilla #32273.

NOTE: This is a candidate for the 7.9 branch and the 7.10 branch.
/external/mesa3d/src/glsl/ast_to_hir.cpp
ec53010c4d02e11171d3c782a41b70cad76788e8 11-Dec-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Minor clean-up in validate_assignment

This code has been changed around a lot, and there were some temporary
variables left around from previous versions.
/external/mesa3d/src/glsl/ast_to_hir.cpp
f0f2ec4d8a50c79c2943ac95eb790fb734d88980 07-Dec-2010 Chad Versace <chad.versace@intel.com> glsl: In ast_to_hir, check sampler array indexing

Raise error if a sampler array is indexed with a non-constant expression.

From section 4.1.7 of the GLSL 1.30 spec:
"Samplers aggregated into arrays within a shader (using square
brackets [ ]) can only be indexed with integral constant
expressions [...]."
/external/mesa3d/src/glsl/ast_to_hir.cpp
b0fc5103cbc9116806a9888f747baed4b8166246 08-Dec-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Inherrit type of declared variable from initializer

Types of declared variables and their initializer must match excatly
except for unsized arrays. Previously the type inherritance for
unsized arrays happened implicitly in the emitted assignment.
However, this assignment is never emitted for uniforms. Now that type
is explicitly copied unconditionally.

Fixes piglit test array-compare-04.vert (bugzilla #32035) and
glsl-array-uniform-length (bugzilla #31985).

NOTE: This is a candidate for the 7.9 branch.
/external/mesa3d/src/glsl/ast_to_hir.cpp
6d36be508ff0765beb6cf6bb95a323ff01e458dd 02-Dec-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Ensure that equality comparisons don't return a NULL IR tree

This fixes bugzilla #32035 and piglit test case array-compare-01 and
array-compare-02.

NOTE: This is a candidate for the 7.9 branch.
/external/mesa3d/src/glsl/ast_to_hir.cpp
6fae1e4c4d33769e2f255d50907b5aa0ab80edd4 06-Dec-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Factor out code which emits a new function into the IR stream.

A future commit will use the newly created function in a second place.
/external/mesa3d/src/glsl/ast_to_hir.cpp
b4f585665c31b1f80d909e38b3b2a9fab0c03076 02-Dec-2010 Eric Anholt <eric@anholt.net> glsl: Mark the array access for whole-array comparisons.

By not doing so, the uniform contents of
glsl-uniform-non-uniform-array-compare.shader_test was getting thrown
out since nobody was recorded as dereferencing the array.
/external/mesa3d/src/glsl/ast_to_hir.cpp
d56c97413ee65e40e3544b89ffca450df9ba1c06 30-Nov-2010 Eric Anholt <eric@anholt.net> glsl: Quiet unreachable no-return-from-function warning.
/external/mesa3d/src/glsl/ast_to_hir.cpp
ff79633d9f930e396933a0ad9564824ec73ea4dc 30-Nov-2010 Eric Anholt <eric@anholt.net> glsl: Fix structure and array comparisions.

We were trying to emit a single ir_expression to compare the whole
thing. The backends (ir_to_mesa.cpp and brw_fs.cpp so far) expected
ir_binop_any_nequal or ir_binop_all_equal to apply to at most a vector
(with matrices broken down by the lowering pass). Break them down to
a bunch of ORed or ANDed any_nequals/all_equals.

Fixes:
glsl-array-compare
glsl-array-compare-02
glsl-fs-struct-equal
glsl-fs-struct-notequal
Bug #31909
/external/mesa3d/src/glsl/ast_to_hir.cpp
001eee52d461233b1e1d6ed3577965e9bcb209e8 05-Nov-2010 Eric Anholt <eric@anholt.net> glsl: Make the symbol table's add_variable just use the variable's name.
/external/mesa3d/src/glsl/ast_to_hir.cpp
e8f5ebf313da3ce33ccbbcf9b72946853035fbdd 05-Nov-2010 Eric Anholt <eric@anholt.net> glsl: Make the symbol table's add_function just use the function's name.
/external/mesa3d/src/glsl/ast_to_hir.cpp
b4cdba687c098eea2ecc61349a4ea02a8769909e 17-Nov-2010 Chad Versace <chad.versace@intel.com> glsl: Fix erroneous cast in ast_jump_statement::hir()

Return values were erroneously cast from (ir_rvalue*) to (ir_expression*).

NOTE: This is a candidate for the 7.9 branch.
/external/mesa3d/src/glsl/ast_to_hir.cpp
6e006273840282e06a08655553821ef8176b2d9c 23-Oct-2010 Chad Versace <chad.versace@intel.com> glsl: Fix ast-to-hir for ARB_fragment_coord_conventions

Function ast_declarator_list::hir(), when processing keywords added by
extension ARB_fragment_coord_conventions, made the mistake of checking only if
the extension was __supported by the driver__. The correct behavior is to check
if the extensi0n is __enabled in the parse state__.

NOTE: this is a candidate for the 7.9 branch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
a75da2c0e85eb6b8279ec895c3f74cc4aefc0257 20-Oct-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Remove useless ir_shader enumeration value.
/external/mesa3d/src/glsl/ast_to_hir.cpp
460da0db4add19b79050b816e3bef086293ab630 20-Oct-2010 Vinson Lee <vlee@vmware.com> glsl: Add assert for unhandled ir_shader case.

Silences this GCC warning.
ast_to_hir.cpp: In function 'void apply_type_qualifier_to_variable(const
ast_type_qualifier*, ir_variable*, _mesa_glsl_parse_state*, YYLTYPE*)'
ast_to_hir.cpp:1768: warning: enumeration value 'ir_shader' not handled
in switch
/external/mesa3d/src/glsl/ast_to_hir.cpp
d03ac0f8d81fd3032d271586d936f14b7d9201d5 15-Oct-2010 Chad Versace <chad.versace@intel.com> glsl: Implement ast-to-hir for bit-logic ops

Implement by adding to ast_expression::hir() the following cases:
- ast_and_assign
- ast_or_assign
- ast_xor_assign
/external/mesa3d/src/glsl/ast_to_hir.cpp
cfdbf8bc8497b29fbdd9fa7bd00da554aecb5962 15-Oct-2010 Chad Versace <chad.versace@intel.com> glsl: Define bit_logic_result_type() in ast_to_hir.cpp

This function type checks the operands of and returns the result type of
bit-logic operations. It replaces the type checking performed in the
following cases of ast_expression::hir() :
- ast_bit_and
- ast_bit_or
- ast_bit_xor
/external/mesa3d/src/glsl/ast_to_hir.cpp
338ed6ec297d76746b6466c26c307722af965e60 15-Oct-2010 Chad Versace <chad.versace@intel.com> glsl: Implement ast-to-hir for bit-shift-assignment

Implement by adding to ast_expression::hir() these cases:
- ast_ls_assign
- ast_rs_assign
/external/mesa3d/src/glsl/ast_to_hir.cpp
c0197ab0af94ed0f3b2d453fb1ee6589f15d8e9c 15-Oct-2010 Chad Versace <chad.versace@intel.com> glsl: Define shift_result_type() in ast_to_hir.cpp

This function type checks the operands of and returns the result type of
bit-shift operations. It replaces the type checking performed in the following
cases of ast_expression::hir() :
- ast_lshift
- ast_rshift
/external/mesa3d/src/glsl/ast_to_hir.cpp
b8276e46f593fd9d938258636a2ba4452d895338 18-Oct-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Don't return NULL IR for erroneous bit-shift operators.

Existing code relies on IR being generated (possibly with error type)
rather than returning NULL. So, don't break - go ahead and generate the
operation. As long as an error is flagged, things will work out.

Fixes fd.o bug #30914.
/external/mesa3d/src/glsl/ast_to_hir.cpp
5c4c36f7f3842e287b303b1eca8d260c37e3580b 09-Oct-2010 Chad Versace <chad@chad-versace.us> glsl: Implement ast-to-hir for binary shifts in GLSL 1.30

Implement by adding the following cases to ast_expression::hir():
- ast_lshift
- ast_rshift
Also, implement ir validation for the new operators by adding the following
cases to ir_validate::visit_leave():
- ir_binop_lshift
- ir_binop_rshift
/external/mesa3d/src/glsl/ast_to_hir.cpp
68a4fc9d5a9dd3b61472451d659275531253b67d 08-Oct-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Add linker support for explicit attribute locations
/external/mesa3d/src/glsl/ast_to_hir.cpp
eee68d3631813580a14fa51fda6f0c959279256c 08-Oct-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Track explicit location in AST to IR translation
/external/mesa3d/src/glsl/ast_to_hir.cpp
e24d35a5b59ca1e75b69a32db6294787378a963f 06-Oct-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Wrap ast_type_qualifier contents in a struct in a union

This will ease adding non-bit fields in the near future.
/external/mesa3d/src/glsl/ast_to_hir.cpp
ca92ae2699c4aad21c0811b9a5562b9223816caf 18-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Properly handle nested structure types.

Fixes piglit test CorrectFull.frag.
/external/mesa3d/src/glsl/ast_to_hir.cpp
81f03393982c29f8f4165b5629c8e8fb708b97a3 16-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Change from has_builtin_signature to has_user_signature.

The print visitor needs this, and the only existing user can work with
has_user_signature just as well.
/external/mesa3d/src/glsl/ast_to_hir.cpp
4dfb89904c0a3d2166e9a3fc0253a254680e91bc 08-Sep-2010 Luca Barbieri <luca@luca-barbieri.com> glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmps

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 <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
10eaa8bcbce1cd6d2e120e913f7abafde9675215 07-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> ast_to_hir: Mark arrays as lvalues in GLSL ES, but prohibit assignment.

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.
/external/mesa3d/src/glsl/ast_to_hir.cpp
a98d5a5ac8b61edc14f60836e5a997bb88fc5c80 05-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Allow overloading of built-ins without hiding in GLSL ES.

The rules are explicitly different from desktop GLSL.
/external/mesa3d/src/glsl/ast_to_hir.cpp
f412fac5b46eb274cbed8e62234d5dbfd859f1fe 05-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Move is_builtin flag back to ir_function_signature.

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.
/external/mesa3d/src/glsl/ast_to_hir.cpp
c98deb18d5836f75cf62562f9304e4d90e0ea920 16-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> ast_to_hir: Reject embedded structure definitions in GLSL ES 1.00.
/external/mesa3d/src/glsl/ast_to_hir.cpp
d8e34e29eb58c38ef60226156aab8f4a93b397b7 07-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> ast_to_hir: Reject unsized array declarations in GLSL ES 1.00.
/external/mesa3d/src/glsl/ast_to_hir.cpp
814c89abdbcd5b841b98746af921796df0362238 05-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Set default language version in mesa_glsl_parse_state constructor.

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.
/external/mesa3d/src/glsl/ast_to_hir.cpp
f09fabc448c0781f0cf9160565e1b0bab59a16e5 07-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Forbid array-types in ?: operator in GLSL 1.10

Fixes bugzilla #30039.
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
e466b182bbf21f62fe6542091f4af3275555db80 01-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Remove unnecessary glsl_symbol_table::get_function parameter return_constructors

Now that constructors are not generated as functions or stored in the
symbol table, there is no need to flag whether or not constructors
should be returned.
/external/mesa3d/src/glsl/ast_to_hir.cpp
a789ca649cb143c0c5bf3209ff1bde398fbd777e 01-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Don't generate constructor functions for structures
/external/mesa3d/src/glsl/ast_to_hir.cpp
63b80f8cc181ded154668e60ac2cf0a6a82d118f 01-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Disallow function declarations within function definitions in GLSL 1.20

The GLSL 1.20 spec specifically disallows this, but it was allowed in
GLSL 1.10.

Fixes piglit test cases local-function-0[13].frag and bugzilla #29921.
/external/mesa3d/src/glsl/ast_to_hir.cpp
1eea96326fa652029e3898e104c715e5464f11e4 31-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> ast_to_hir: Add support for bit-wise operators (but not shifts).

Previously, using bit-wise operators in some larger expression would
crash on a NULL pointer dereference. This code at least doesn't crash.

Fixes piglit test bitwise-01.frag.
/external/mesa3d/src/glsl/ast_to_hir.cpp
de3b40d8cdc42cc1cd71dd65c90d6d569d922fc6 26-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Remove a couple FINISHME comments that have already been resolved
/external/mesa3d/src/glsl/ast_to_hir.cpp
a044285e25615f2d97636fe3ba47d580c3537bc4 23-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Move built-ins to live beyond the global scope.

Per the GLSL 1.20 specification (presumably a clarification of 1.10).

Also, when creating user functions, make a new ir_function that shadows the
built-in ir_function, rather than adding new signatures. User functions
are supposed to hide built-ins, not overload them.

Fixes piglit tests redeclaration-{04, 12, 14}.vert.
/external/mesa3d/src/glsl/ast_to_hir.cpp
5d25746640ee27882b69a962459727cf924443db 24-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Refactor variable declaration handling.

Moving the check for an earlier variable declaration helps cleanly
separate out the re-declaration vs. new declaration code a bit. With
that in place, conflicts between variable names and structure types or
function names aren't caught by the earlier "redeclaration" error
message, so check the return type on glsl_symbol_table::add_variable
and issue an error there. If one occurs, don't emit the initializer.

Fixes redeclaration-01.vert and redeclaration-09.vert.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.cpp
ac2376e6f51677ab321930b0200a79d1683cfbba 26-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Don't add overloads to existing structure constructors.

Instead, make a new ir_function and try to add it to the symbol table.

Fixes piglit test redeclaration-08.vert.
/external/mesa3d/src/glsl/ast_to_hir.cpp
e09591317b2470fe9c104606577d4e10255727c0 26-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Remove name_declared_this_scope check when adding functions.

Instead, rely on the symbol table's rules.

Fixes redeclaration-02.vert.
/external/mesa3d/src/glsl/ast_to_hir.cpp
e9c7ceed27f6811ad1cae46c93ce9bc3fb3668d8 22-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Use a single shared namespace in the symbol table.

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.
/external/mesa3d/src/glsl/ast_to_hir.cpp
5226f8c7b0025031e8540adc93ecfe0b36b8f90f 25-Aug-2010 Aras Pranckevicius <aras@unity3d.com> glsl: fix crash with variable indexing into array in a struct

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
e11757bb896e3dadc54fb3d18adf4b71e3e883b3 23-Aug-2010 Eric Anholt <eric@anholt.net> glsl: When unable to assign the initializer for a const variable, set it to 0.

This prevents assertion failures or cascading errors after we've
logged the fact that we were unable to handle the initializer.

Fixes unsized-array-non-const-index-2.vert
/external/mesa3d/src/glsl/ast_to_hir.cpp
76e96d74f49cc262ceaf2ed6c48d2f4ed21d219f 23-Aug-2010 Eric Anholt <eric@anholt.net> glsl: Cleanly fail when a function has an unknown return type.

Bug #29608.
/external/mesa3d/src/glsl/ast_to_hir.cpp
a721abfbd1724e83381b46fc670bb38fbde76f69 23-Aug-2010 Eric Anholt <eric@anholt.net> glsl: Trim the size of uniform arrays to the maximum element used.

Fixes glsl-getactiveuniform-array-size.
/external/mesa3d/src/glsl/ast_to_hir.cpp
13b3d4c23d9d088a5a2b3bd657f1f163e42e4d8b 22-Aug-2010 Vinson Lee <vlee@vmware.com> glsl: Silence unused variable warning.

The variable is actually used but only in the body of an assert.
/external/mesa3d/src/glsl/ast_to_hir.cpp
e511a35fc53fb75a2401d8a94c0c35634175c575 22-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Handle array declarations in function parameters.

The 'vec4[12] foo' style already worked, but the 'vec4 foo[12]' style
did not. Also, 'vec4[] foo' was wrongly accepted.

Fixes piglit test cases array-19.vert and array-21.vert.

May fix fd.o bug #29684 (or at least part of it).
/external/mesa3d/src/glsl/ast_to_hir.cpp
edd180f03216d2fcb2771aeea34e7015fb2b83c3 20-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> ast_to_hir: Reject function names that start with "gl_".

Fixes piglit test redeclaration-03.vert.
/external/mesa3d/src/glsl/ast_to_hir.cpp
826a39cb14244820e8539a2328bb52447348f184 20-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> ast_to_hir: Fix crash when a function shadows a variable.

The code would attempt to add a new signature to the ir_function, which
didn't exist. Simply bailing out/returning early seems reasonable.

Fixes piglit test redeclaration-02.vert, and fixes a crash in
redeclaration-03.vert (the test still fails).
/external/mesa3d/src/glsl/ast_to_hir.cpp
665d75cc5a23f8024034d0c4176fb281f94a30e9 18-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Fix scoping bug in if statements.

Fixes glslparsertest/glsl2/scoping-01.frag (successfully compiled but
should've failed) and scoping-02.frag (assertion triggered).
/external/mesa3d/src/glsl/ast_to_hir.cpp
768b55a5268572ff9fd03e57e92775882eb0a821 14-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Remove unnecessary use of 'struct' before type names

In C++ you don't have to say 'struct' or 'class' if the declaration of
the type has been seen. Some compilers will complain if you use
'struct' when 'class' should have been used and vice versa.

Fixes bugzilla #29539.
/external/mesa3d/src/glsl/ast_to_hir.cpp
202604e8160157e4e80b3458175e0170d168e557 12-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Don't declare a variable called sig that shadows the other one

Accidentally having a variable called 'sig' within an if-statement
cause the higher scope 'sig' to always be NULL. As a result a new
function signature was created for a function definition even when one
already existed from a prototype declaration.

Fixes piglit test case glsl-function-prototype (bugzilla #29520).
/external/mesa3d/src/glsl/ast_to_hir.cpp
8048226b7b1bbe8fd89f9c32fa4fadca4b8760c4 05-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Insert global declarations at the top of the instruction stream.

Fixes use-before-decl in glslparsertest shaders.

Fixes:
CorrectFull.frag
CorrectModule.frag
/external/mesa3d/src/glsl/ast_to_hir.cpp
046bef235744e891e4a48076e1a3ff9a61a63092 05-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Remove the shader_in/shader_out tracking separate from var->mode.

I introduced this for ir_dead_code to distinguish function parameter
outvals from varying outputs. Only, since ast_to_hir's
current_function is unset when setting up function parameters (they're
needed for making the function signature in the first place), all
function parameter outvals were marked as shader outputs anyway. This
meant that an inlined function's cloned outval was marked as a shader
output and couldn't be dead-code eliminated. Instead, since
ir_dead_code doesn't even look at function parameters, just use
var->mode.

The longest Mesa IR coming out of ir_to_mesa for Yo Frankie drops from
725 instructions to 636.
/external/mesa3d/src/glsl/ast_to_hir.cpp
8e9ce2eb56a087c2544112700ae1abe3f96648dd 04-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Don't try to construct an ir_assignment with an invalid LHS
/external/mesa3d/src/glsl/ast_to_hir.cpp
8273bd46877e2ea2b8a02b87a11c68102d07e1f2 04-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Make the clone() method take a talloc context.

In most cases, we needed to be reparenting the cloned IR to a
different context (for example, to the linked shader instead of the
unlinked shader), or optimization before the reparent would cause
memory usage of the original object to grow and grow.
/external/mesa3d/src/glsl/ast_to_hir.cpp
1c325af4d6b907e0a47ab7f868a2a78f054f153f 29-Jul-2010 Aras Pranckevicius <aras@unity3d.com> glsl2: Fix stack smash when ternary selection is used.
/external/mesa3d/src/glsl/ast_to_hir.cpp
fa33d0b85403da94e3f4a7e6c868af215c076b4b 29-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Fix spelling of "initializer."
/external/mesa3d/src/glsl/ast_to_hir.cpp
4a962170d7cf4243d6ae156fca20a6167388925d 28-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add support for redeclaring layout of gl_FragCoord for ARB_fcc.

Fixes:
glsl-arb-fragment-coord-conventions
/external/mesa3d/src/glsl/ast_to_hir.cpp
8d8469eb2ade4fd48188403351a38f740987fb80 01-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Perform some semantic checking of ARB_fcc layout qualifiers

The rest cannot be handled until built-in variables (i.e.,
gl_FragCoord) can be redeclared to add qualifiers.
/external/mesa3d/src/glsl/ast_to_hir.cpp
a0879b9dd438d78635f047cdd5ed4c72bc831b60 23-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Put side effects of the RHS of logic_or in the right branch.

Kind of missing the point to only do the side effects if the LHS
evaluates as true.

Fixes:
glsl1-|| operator, short-circuit
/external/mesa3d/src/glsl/ast_to_hir.cpp
9703ed05e684f4269cd8af27c94e9b6bf8781d85 23-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: When setting the size of an unsized array, set its deref's size too.
/external/mesa3d/src/glsl/ast_to_hir.cpp
47c90b144729e3edf3b5cbf5b260c1c46e429879 22-Jul-2010 Carl Worth <cworth@cworth.org> glsl2: Fix expected type for multiplying vector with non-square matrix.

Previously, the compiler expected the result of the multiplication to
be of the same type as the vector. This is correct for square
matrices, but wrong for all others.

We fix this by instead expecting a vector with the same number of rows
as the matrix (for the case of M*v with a column vector) or the same
number of columns as the matrix (for v*M with a row vector).

This fix causes the following four glean tests to now pass:

glsl1-mat4x2 * vec4
glsl1-vec2 * mat4x2 multiply
glsl1-vec3 * mat4x3 multiply
glsl1-vec4 * mat3x4 multiply
/external/mesa3d/src/glsl/ast_to_hir.cpp
2d1ed7b1b112cf13dd7eda7f500691f4c98a1ccc 22-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: When a "continue" happens in a "for" loop, run the loop expression.

Fixes:
glsl1-for-loop with continue

Bug #29097
/external/mesa3d/src/glsl/ast_to_hir.cpp
e1d71850faba23d1bea3858a8c2e05a45fd21143 20-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> ast_to_hir: Fix bug in constant initializers.

Implicit conversions were not being performed, nor was there any
type checking - it was possible to have, say, var->type == float
and var->constant_value->type == int. Later use of the constant
expression would trigger an assertion.

Fixes piglit test const-implicit-conversion.frag.
/external/mesa3d/src/glsl/ast_to_hir.cpp
c24bcad9f88379ffba9e2f0ff92f22cdf60c2927 21-Jul-2010 Carl Worth <cworth@cworth.org> glsl: Correctly handle unary plus operator.

Previously, any occurence of the unary plus operator would trigger a
bogus type mismatch error. Fix this by making the ast_plus case look
more like the ast_neg case as far as type-checking is concerned.

With this change the shaders/CorrectPreprocess8.frag test in piglit
now passes.
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.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_to_hir.cpp
21b0dbd79937e9d6787f045af7d60d4b6c649ec8 21-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: talloc the glsl_struct_field[] we use to look up structure types.

Since the types are singletons across the lifetime of the compiler,
repeatedly compiling a program with the same structure type defined
would drop a copy of the array on the floor per compile.

This is a bit tricky because the static GLSL types are not called with
the talloc-based new, so we have to use the global type context, which
may not be initialized yet.
/external/mesa3d/src/glsl/ast_to_hir.cpp
2b7c42b40ae459f7b290eb134d6dabd075aab9f0 17-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Disallow non-constant array indexing for unsized arrays.

Fixes piglit test unsized-array-non-const-index.vert.
/external/mesa3d/src/glsl/ast_to_hir.cpp
81d664f099a5fd5fac777480532fb4307d591451 13-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Move temp declaration to correct side of if-statement in IR
/external/mesa3d/src/glsl/ast_to_hir.cpp
0b9ae3befb0bf80e000b159fd44c961a144f9c36 12-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add declarations for temporaries to instruction stream

Temporary variables added for &&, ||, and ?: were not being added to
the instruction stream. This resulted in either test failures or
Valgrind being angry after the original IR tree was destroyed by
talloc_free. The talloc_free caused the ir_variables to be destroyed
even though they were still referenced.
/external/mesa3d/src/glsl/ast_to_hir.cpp
dfd30ca6a95a7d95835dad78ffe1fba4d1f4ef69 08-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Remove generate_temporary and global temporary counter.

Most places in the code simply use a static name, which works because
names are never used to look up an ir_variable. generate_temporary is
simply unnecessary (and looks like it would leak memory, and isn't
thread safe...)
/external/mesa3d/src/glsl/ast_to_hir.cpp
43b5b03d67ce890e867c81d4a5cfc4871d711d43 07-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Actually add the declaration of _post_incdec_temp.
/external/mesa3d/src/glsl/ast_to_hir.cpp
e78e0fa42b49b50ed1150f7fdb74bf942ebd6bcf 07-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Put the initializer in the instruction stream after the declaration
/external/mesa3d/src/glsl/ast_to_hir.cpp
2e85f993d8a014b53ad2f6d295cf66d3fb38b091 07-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> Revert "glsl2: Put the declaration in the instruction stream before its initializer."

This change causes segfaults in other tests. A fix for both sets of
segfaults is coming.

This reverts commit d4d630b72c7b7f38074addda0f1b819608247d93.
/external/mesa3d/src/glsl/ast_to_hir.cpp
d4d630b72c7b7f38074addda0f1b819608247d93 07-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Put the declaration in the instruction stream before its initializer.

This fixes a regression in the generated code from when I did the
ir_validate.cpp-driven rework of assignments.
/external/mesa3d/src/glsl/ast_to_hir.cpp
ca088cc277ce9f986693c857f3961dc0e1a4d91c 07-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Clone methods return the type of the thing being cloned

This is as opposed to returning the type of the base class of the hierarchy.
/external/mesa3d/src/glsl/ast_to_hir.cpp
6f0823da09384cc1b557385b9e19a9cc7e901ad7 02-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Support AST-to-IR translation of invariant keyword
/external/mesa3d/src/glsl/ast_to_hir.cpp
12873fa4e332959295154edfe957c0af79af5e74 01-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Don't bounds check unsize array redeclarations

This along with several previous commits fix test CorrectUnsizedArray.frag.
/external/mesa3d/src/glsl/ast_to_hir.cpp
127308b4be077e5bdf60f76320307550921e86bb 01-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add gl_MaxTextureCoords
/external/mesa3d/src/glsl/ast_to_hir.cpp
cd00d5b88caa41ebf4b407126f314832f9fdae54 01-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Default delcaration of gl_TexCoord is unsized
/external/mesa3d/src/glsl/ast_to_hir.cpp
5466b63968b98c9627b8dd207ea2bebf838b5268 01-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Change order of semaintic checks on variable declarations

This will make it easier to support more (valid) kinds of redeclarations.
/external/mesa3d/src/glsl/ast_to_hir.cpp
77049a702ad54e09c4102fe8c964e069944f83e5 30-Jun-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Implement AST->HIR support for the "discard" instruction.
/external/mesa3d/src/glsl/ast_to_hir.cpp
c7f4ff193a6f7cfae2e4cdc6c4b9162a16226dc0 30-Jun-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Fix storing of dead memory in the symbol table.

decl->identifier is part of the AST, so it doesn't live very long.
Instead, add var->name which is owned by var.
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp
506199b852390e14a1d78392285bee8f06b6ede7 30-Jun-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Keep the same number of components in implicit conversions.

Fixes piglit test glsl-implicit-conversion-01.
/external/mesa3d/src/glsl/ast_to_hir.cpp
49e3577b91f44013746f7a3db411e7041b7d899e 28-Jun-2010 Ian Romanick <ian.d.romanick@intel.com> glsl_type: Add get_record_instance method
/external/mesa3d/src/glsl/ast_to_hir.cpp
12681610f54b40324e9e342dc25976c223614b81 26-Jun-2010 Ian Romanick <ian.d.romanick@intel.com> glsl_type: Remove vector and matrix constructor generators

All scalar, vector, and matrix constructors are generated in-line
during AST-to-HIR translation. There is no longer any need to
generate function versions of the constructors.
/external/mesa3d/src/glsl/ast_to_hir.cpp
6de825650560198eb97f19e72b2d56e68e3d7a63 29-Jun-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Check for non-void functions that don't have a return statement.

This doesn't do any control flow analysis to ensure that the return
statements are actually reached.

Fixes piglit tests function5.frag and function-07.vert.
/external/mesa3d/src/glsl/ast_to_hir.cpp
ac04c257e31fe012dac750bcf5bf3134ba07ebdc 29-Jun-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Reject return types with qualifiers.

Fixes piglit test return-qualifier.frag.
/external/mesa3d/src/glsl/ast_to_hir.cpp
18707eba1cd6c07fa8b63d0ba5b26f6433f1ae91 29-Jun-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Check that returned expressions match the function return type.

From my reading of the specification, implicit conversions are not
allowed. ATI seems to agree, though nVidia allows it without warning.
/external/mesa3d/src/glsl/ast_to_hir.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_to_hir.cpp