History log of /external/mesa3d/src/glsl/ir.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2ea3ab14f2182978f471674c9dfce029d37f70a7 10-Jul-2012 Eric Anholt <eric@anholt.net> glsl: Add a "ubo_load" expression type for fetches from UBOs.

Drivers will probably want to be able to take UBO references in a
shader like:

uniform ubo1 {
float a;
float b;
float c;
float d;
}

void main() {
gl_FragColor = vec4(a, b, c, d);
}

and generate a single aligned vec4 load out of the UBO. For intel,
this involves recognizing the shared offset of the aligned loads and
CSEing them out. Obviously that involves breaking things down to
loads from an offset from a particular UBO first. Thus, the driver
doesn't want to see

variable_ref(ir_variable("a")),

and even more so does it not want to see

array_ref(record_ref(variable_ref(ir_variable("a")),
"field1"), variable_ref(ir_variable("i"))).

where a.field1[i] is a row_major matrix.

Instead, we're going to make a lowering pass to break UBO references
down to expressions that are obvious to codegen, and amenable to
merging through CSE.

v2: Fix some partial thoughts in the ir_binop comment (review by Kenneth)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir.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/ir.cpp
8e31f961e6cfd9680b33647c053b0f708abb8a18 14-Jun-2012 Paul Berry <stereotype441@gmail.com> glsl: Add unary operation ir_unop_f2u.

Previously, we performed conversions from float->uint by a two step
process: float->int->uint. However, on platforms that use saturating
conversions (e.g. i965), this didn't work, because if the source value
was larger than the maximum representable int (0x7fffffff), then
converting it to an int would clamp it to 0x7fffffff.

This patch just adds the new opcode; further patches will adapt
optimization passes and back-ends to use it, and then finally the
ast_to_hir logic will be modified to emit the new opcode.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir.cpp
9aa3fbcc2e1f46416f1d334427ebe48388584384 04-Jun-2012 Matt Turner <mattst88@gmail.com> glsl: Add is_basis function

Determines whether it's a basis vector, i.e., a vector with one element
equal to 1 and all other elements equal to 0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir.cpp
4fab1505594acf0cc02a53d01ce20c8b17e3e913 08-May-2012 Olivier Galibert <galibert@pobox.com> glsl: Bitwise conversion operator support in ir_expression.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir.cpp
500dcbb1aa991d4c92200fcacd6eb288bb2638d7 08-May-2012 Olivier Galibert <galibert@pobox.com> glsl: New unary opcodes for ARB_shader_bit_encoding support.

The opcodes are bitcast_f2u, bitcast_f2i, bitcast_i2f and bitcast_u2f.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir.cpp
2ff7b121cad2892698ff1aa7690dd361ea2739a7 02-May-2012 Olivier Galibert <galibert@pobox.com> glsl: Add an origin pointer in the function signature object.

This points to the object with the function body, allowing us to map
from a built-in prototype to the actual body with IR code to execute.

Signed-off-by: Olivier Galibert <galibert@pobox.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir.cpp
8ec01ba2ff95449674c779c05afcd32bbf7dbdc8 02-May-2012 Olivier Galibert <galibert@pobox.com> glsl: Add methods to copy parts of one ir_constant into another.

- copy_masked_offset copies part of a constant into another,
assign-like.

- copy_offset copies a constant into (a subset of) another,
funcall-return like.

These methods are to be used to trace through assignments and function
calls when computing a constant expression.

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/ir.cpp
27a198388ed78c83d9a255efc0fb2294d985f3ad 02-May-2012 Olivier Galibert <galibert@pobox.com> glsl: Extend ir_constant::zero to handle more types.

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/ir.cpp
82065fa20ee3f2880a070f1f4f75509b910cedde 21-Sep-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Remove ir_call::get_callee() and set_callee().

Previously, set_callee() performed some assertions about the type of the
ir_call; protecting the bare pointer ensured these checks would be run.

However, ir_call no longer has a type, so the getter and setter methods
don't actually do anything useful. Remove them in favor of accessing
callee directly, as is done with most other fields in our IR.

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/ir.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/ir.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/ir.cpp
7a348b91ce983c7efb1db61f36083f7d8d088f26 13-Mar-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Make ir_dereference_variable ctor assert the variable exists.

This also seems like a bad idea. There were too many instances for me
to thoroughly scan the code as I did with the last two patches, but a
quick scan indicated that most callers newly allocate a variable,
dereference it, or NULL-check. In some cases, it wasn't clear that the
value would be non-NULL, but they didn't check for error_type either.

At any rate, not checking for this is a bug, and assertions will trigger
it earlier and more reliably than returning error_type.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ir.cpp
2cd652f810e3417ff458f23a8c72a0c84e342258 13-Mar-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Make ir_dereference_record constructor assert the variable exists.

Providing a NULL pointer to the ir_dereference_record() constructor
seems like a bad idea. Currently, if provided NULL, it returns a
partially constructed value of error type. However, none of the callers
are prepared to handle that scenario.

Code inspection shows that all callers do one of the following:
- Already NULL-check the argument prior to creating the dereference
- Already deference the argument (and thus would crash if it were NULL)
- Newly allocate the argument.

Thus, it should be safe to simply assert the value passed is not NULL.
This should also catch issues right away, rather than dying later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ir.cpp
25b0d45d038774406f2bb7173abc33a3cb261db2 13-Mar-2012 Kenneth Graunke <kenneth@whitecape.org> glsl: Make ir_dereference_array constructor assert the variable exists.

Providing a NULL pointer to the ir_dereference_array() constructor seems
like a bad idea. Currently, if provided NULL, it returns a partially
constructed value of error type. However, none of the callers are
prepared to handle that scenario.

Code inspection shows that all callers do one of the following:
- Already NULL-check the argument prior to creating the dereference
- Already deference the argument (and thus would crash if it were NULL)
- Newly allocate the argument.

Thus, it should be safe to simply assert the value passed is not NULL.
This should also catch issues right away, rather than dying later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ir.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/ir.cpp
baf7f99fd7a092a1390b7a145e09caa5325a8116 21-Oct-2011 Paul Berry <stereotype441@gmail.com> glsl: add ir_variable::determine_interpolation_mode() function.

This function determines how a variable should be interpolated based
both on interpolation qualifiers and the current shade model.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
/external/mesa3d/src/glsl/ir.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/ir.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/ir.cpp
93c26d8baf5294b77e019b90d9995b5da565ea3c 07-Sep-2011 Ian Romanick <ian.d.romanick@intel.com> glsl: Remove unused method ir_variable::component_slots

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir.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/ir.cpp
1e3bcbdf31f09666ba358f35ff9486faee3642ca 25-Feb-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Add a new ir_txs (textureSize) opcode to ir_texture.

One unique aspect of TXS is that it doesn't have a coordinate.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
/external/mesa3d/src/glsl/ir.cpp
a52b53b56e2b5d5853345d8bcd2a4ff50e495c20 03-Aug-2011 Paul Berry <stereotype441@gmail.com> glsl: Make is_lvalue() and variable_referenced() const.

These functions don't modify the target instruction, so it makes sense
to make them const. This allows these functions to be called from ir
validation code (which uses const to ensure that it doesn't
accidentally modify the IR being validated).

Reviewed-by: Chad Versace <chad@chad-versace.us>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
/external/mesa3d/src/glsl/ir.cpp
ddc1c96390b685bb95f7431e862c3a64fcefa085 12-Jul-2011 Paul Berry <stereotype441@gmail.com> glsl: Move type_contains_sampler() into glsl_type for later reuse.

The new location, as a member function of glsl_type, is more
consistent with queries like is_sampler(), is_boolean(), is_float(),
etc. Placing the function inside glsl_type also makes it available to
any code that uses glsl_types.
/external/mesa3d/src/glsl/ir.cpp
20ef96c7ff3f17fbf97e0452a37553249b2b005c 15-Jun-2011 Bryan Cain <bryancain3@gmail.com> glsl: Add ir_unop_i2u and ir_unop_u2i operations.

These are necessary to handle int/uint constructor conversions. For
example, the following code currently results in a type mismatch:

int x = 7;
uint y = uint(x);

In particular, uint(x) still has type int.

This commit simply adds the new operations; it does not generate them,
nor does it add backend support for them.

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/ir.cpp
d350ef1682ad6432b8a10e0f6aabdfe77ccb4370 15-Mar-2011 Brian Paul <brianp@vmware.com> glsl: add cast to silence signed/unsigned comparison warning
/external/mesa3d/src/glsl/ir.cpp
233b88eab9d8095523ebae3c4be1dbf2e2bd856a 25-Feb-2011 Kenneth Graunke <kenneth@whitecape.org> glsl: Explicitly specify a type when reading/printing ir_texture.

This is necessary for GLSL 1.30+ shadow sampling functions, which return
a single float rather than splatting the value to a vec4 based on
GL_DEPTH_TEXTURE_MODE.
/external/mesa3d/src/glsl/ir.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/ir.cpp
d3073f58c17d8675a2ecdd5dfa83e5520c78e1a8 21-Jan-2011 Kenneth Graunke <kenneth@whitecape.org> Convert everything from the talloc API to the ralloc API.
/external/mesa3d/src/glsl/ir.cpp
bc04d244f5a86fd7085e3d648949413e2d2ec797 27-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Propagate depth layout qualifier from AST to IR
/external/mesa3d/src/glsl/ir.cpp
5fc57f471b10e74546f999269a2a8f9186da9731 27-Jan-2011 Chad Versace <chad.versace@intel.com> glsl: Define enum ir_depth_layout
/external/mesa3d/src/glsl/ir.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/ir.cpp
1412dea94953243b5cd3a452f676afd046101192 07-Dec-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Add type inference support for remaining expression opcodes.
/external/mesa3d/src/glsl/ir.cpp
b381eff1411dea5b9e0c9fbc8641a8760052b2eb 02-Dec-2010 Eric Anholt <eric@anholt.net> glsl: Fix flipped return of has_value() for array constants.

Fixes glsl-array-uniform.
/external/mesa3d/src/glsl/ir.cpp
6b937465d4aeab72fabcfe5250d477cf6790a521 03-Nov-2010 Eric Anholt <eric@anholt.net> glsl: Add a helper constructor for expressions that works out result type.

This doesn't cover all expressions or all operand types, but it will
complain if you overreach and it allows for much greater slack on the
programmer's part.
/external/mesa3d/src/glsl/ir.cpp
02939d643f878ce3a3dcd2e7b2c6f035c64ecda7 19-Nov-2010 Eric Anholt <eric@anholt.net> glsl: Add a helper function for determining if an rvalue could be a saturate.

Hardware pretty commonly has saturate modifiers on instructions, and
this can be used in codegen to produce those, without everyone else
needing to understand clamping other than min and max.
/external/mesa3d/src/glsl/ir.cpp
11d6f1c69871d0b7edc28f639256460839fccd2d 16-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Add ir_quadop_vector expression

The vector operator collects 2, 3, or 4 scalar components into a
vector. Doing this has several advantages. First, it will make
ud-chain tracking for components of vectors much easier. Second, a
later optimization pass could collect scalars into vectors to allow
generation of SWZ instructions (or similar as operands to other
instructions on R200 and i915). It also enables an easy way to
generate IR for SWZ instructions in the ARB_vertex_program assembler.
/external/mesa3d/src/glsl/ir.cpp
13f57d42b6929f50d8ef8b4123f46a61c46fde7b 09-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Add unary ir_expression constructor
/external/mesa3d/src/glsl/ir.cpp
8e498050dc1a1285c2218fdf4ea506c1cdcd9dd8 16-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Add ir_rvalue::is_negative_one predicate
/external/mesa3d/src/glsl/ir.cpp
f2616e56de8a48360cae8f269727b58490555f4d 18-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Add ir_unop_sin_reduced and ir_unop_cos_reduced

The operate just like ir_unop_sin and ir_unop_cos except that they
expect their inputs to be limited to the range [-pi, pi]. Several
GPUs require this limited range for their sine and cosine
instructions, so having these as operations (along with a to-be-written
lowering pass) helps this architectures.

These new operations also matche the semantics of the
GL_ARB_fragment_program SCS instruction. Having these as operations
helps in generating GLSL IR directly from assembly fragment programs.
/external/mesa3d/src/glsl/ir.cpp
ad87f2ddc7e6b95e3dd5bbe4d2b19703d305c74e 19-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Make is_zero and is_one virtual methods of ir_rvalue

This eliminates the need in some cames to validate that an rvalue is
an ir_constant before checking to see if it's 0 or 1.
/external/mesa3d/src/glsl/ir.cpp
855c66bde7e51c3486e4c6abc7096a1a949a98e1 18-Nov-2010 Vinson Lee <vlee@vmware.com> glsl: Fix 'control reaches end of non-void function' warning.

Fix this GCC warning.
ir.cpp: In static member function
'static unsigned int ir_expression::get_num_operands(ir_expression_operation)':
ir.cpp:199: warning: control reaches end of non-void function
/external/mesa3d/src/glsl/ir.cpp
007f4881503b69055d65cfb20bd237673779786b 18-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Refactor get_num_operands.

This adds sentinel values to the ir_expression_operation enum type:
ir_last_unop, ir_last_binop, and ir_last_opcode. They are set to the
previous one so they don't trigger "unhandled case in switch statement"
warnings, but should never be handled directly.

This allows us to remove the huge array of 1s and 2s in
ir_expression::get_num_operands().
/external/mesa3d/src/glsl/ir.cpp
9935fe705df44bb633039ca74332cc0c126ccc30 17-Nov-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Remove the ir_binop_cross opcode.
/external/mesa3d/src/glsl/ir.cpp
38e55153af031e48125b1cd0a5d939bb92379ddc 12-Nov-2010 Ian Romanick <ian.d.romanick@intel.com> glsl: Refactor is_vec_{zero,one} to be methods of ir_constant

These predicates will be used in other places soon.
/external/mesa3d/src/glsl/ir.cpp
d85d25dd1f4fd281bd210ba6ba5135ba1e3b535f 14-Oct-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Add a new ir_unop_round_even opcode for GLSL 1.30's roundEven.

Also, update ir_to_mesa's "1.30 is unsupported" case to "handle" it.
/external/mesa3d/src/glsl/ir.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/ir.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/ir.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/ir.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/ir.cpp
3a5ce85cfa4914711e56c8cf831699242618928e 02-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add ir_unop_noise
/external/mesa3d/src/glsl/ir.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/ir.cpp
351525d534268b08c090f9ce42a67e9329a969ae 27-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> ir_expression: Add static operator_string method

I've used this in quite a few debug commits that never reached an
up-stream tree.
/external/mesa3d/src/glsl/ir.cpp
3b85f1cc6cb12e9d4931e12cf29adde578f389fd 27-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add cmp field to ir_loop

This reprents the type of comparison between the loop induction
variable and the loop termination value.
/external/mesa3d/src/glsl/ir.cpp
54b35e673596d767a13f06f4d7ec1089e18fd46e 02-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Add proper handling for constant matrix-from-matrix constructors.

Fixes piglit test case constructor-21.vert and changes
constructor-22.vert to give the correct output.
/external/mesa3d/src/glsl/ir.cpp
1f7c7df40f830e164f96df4468a2b4fa365c4b84 02-Sep-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Move generate_constructor_(matrix|vector) to ir_constant ctor.
/external/mesa3d/src/glsl/ir.cpp
a4262874f84e25412cb9bc53b3f1771e4017e27c 01-Sep-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Allow ir_constant::zero to create boolean constants
/external/mesa3d/src/glsl/ir.cpp
30a086552827b82738421ff2d562e3c8c1da2735 29-Aug-2010 Vinson Lee <vlee@vmware.com> glsl: Completely initialize value member in ir_constant constructor.

The
ir_constant::ir_constant(const struct glsl_type *type, exec_list *value_list)
did not completely initialize the entire value member.

Fixes piglit glsl-fs-sampler-numbering-2 valgrind uninitialized value
error in softpipe and llvmpipe.
/external/mesa3d/src/glsl/ir.cpp
f67400d4671ce7776f71cafced6546dddecba42c 29-Aug-2010 Vinson Lee <vlee@vmware.com> glsl: Initialize the rest of values of ir_constant::value.

Fixes valgrind uninitialized value errors in the piglit shader tests for
softpipe and llvmpipe.
/external/mesa3d/src/glsl/ir.cpp
b6f15869b324ae64a00d0fe46fa3c8c62c1edb6c 21-Aug-2010 Kenneth Graunke <kenneth@whitecape.org> glsl: Move is_built_in flag from ir_function_signature to ir_function.

Also rename it to "is_builtin" for consistency.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
/external/mesa3d/src/glsl/ir.cpp
c735d85395f8f0c0a71b04ebc728390970271fe2 26-Aug-2010 Eric Anholt <eric@anholt.net> glsl: Don't consider things with a type containing a sampler as an lvalue.

We had ad-hoc handled some common cases by flagging sampler-typed
variables as read_only, and rejected initializers of samplers.
However, people could sneak them in in all sorts of surprising ways,
like using whole-array or structure assignment.

Fixes:
glslparsertest/glsl2/sampler-01.frag
glslparsertest/glsl2/sampler-03.frag
glslparsertest/glsl2/sampler-04.frag
glslparsertest/glsl2/sampler-06.frag

Bug #27403.
/external/mesa3d/src/glsl/ir.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/ir.cpp
5e9ac94cc44ef4f97063d7b696411b2a4be16f36 23-Aug-2010 Eric Anholt <eric@anholt.net> mesa: Add new ir_unop_any() expression operation.

The previous any() implementation would generate arg0.x || arg0.y ||
arg0.z. Having an expression operation for this makes it easy for the
backend to generate something easier (DPn + SNE for 915 FS, .any
predication on 965 VS)
/external/mesa3d/src/glsl/ir.cpp
664364052f362af2789e6b0fa88b6a5ba66ba936 17-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> ir_constant: Don't assert on out-of-bounds array accesses

Several optimization paths, including constant folding, can lead to
accessing an ir_constant array with an out of bounds index. The GLSL
spec lets us produce "undefined" results, but it does not let us
crash.

Fixes piglit test case glsl-array-bounds-01 and glsl-array-bounds-03.
/external/mesa3d/src/glsl/ir.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/ir.cpp
5a7758efbe14dee026245a4f4f4fb3ccf7b2c23b 03-Aug-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Add ir_assignment::write_mask and associated methods

Replace swizzles on the LHS with additional swizzles on the RHS and a
write mask in the assignment instruction. As part of this add
ir_assignment::set_lhs. Ideally we'd make ir_assignment::lhs private
to prevent erroneous writes, but that would require a lot of code
butchery at this point.

Add ir_assignment constructor that takes an explicit write mask. This
is required for ir_assignment::clone, but it can also be used in other
places. Without this, ir_assignment clones lose their write masks,
and incorrect IR is generated in optimization passes.

Add ir_assignment::whole_variable_written method. This method gets
the variable on the LHS if the whole variable is written or NULL
otherwise. This is different from
ir->lhs->whole_variable_referenced() because the latter has no
knowledge of the write mask stored in the ir_assignment.

Gut all code from ir_to_mesa that handled swizzles on the LHS of
assignments. There is probably some other refactoring that could be
done here, but that can be left for another day.
/external/mesa3d/src/glsl/ir.cpp
960ba0014af7009f8543c55f455271cf3cb45cd6 02-Aug-2010 Eric Anholt <eric@anholt.net> glsl2: Initialize the ARB_fcc fields of ir_variable.

Fixes intermittent failure in glsl-arb-fragment-coord-conventions.
/external/mesa3d/src/glsl/ir.cpp
939a1807fe5a70db25725335ba0acccce8b01db3 30-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Initialize ir_function_signature::is_built_in.

Fixes a valgrind error.
/external/mesa3d/src/glsl/ir.cpp
62c4763b707e2227409f81b09dd5cf6e4410ea6a 29-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Fix spelling of "sentinel."
/external/mesa3d/src/glsl/ir.cpp
ee9a3a51b61f0afe75b4b8b0c3025310140437ec 22-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Add new ir_constant::zero static method.

This conveniently creates a zero value of whatever type you want.
/external/mesa3d/src/glsl/ir.cpp
f9b0e5e322a676cf778dc3785281040fcc0bd248 28-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: When stealing var->constant_value, steal its children as well.

Fixes:
glsl1-GLSL 1.20 uniform array constructor
/external/mesa3d/src/glsl/ir.cpp
fbaca31352678ab7d7bf132f0c9a6aa29ca9fabf 27-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Also steal the constant components of aggregate-typed ir_constants.
/external/mesa3d/src/glsl/ir.cpp
eb2cc4f1b1f5ac657c632aa41da5f23eb1cdbe10 23-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Steal ir_variable's constant_value field.

Fixes a link-time crash in glsl-vs-cross-3.
/external/mesa3d/src/glsl/ir.cpp
0a89175a35ba3ac2a94d0ba9bcc9926edc8927e3 23-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> glsl2: Initialize ir_instruction::type and ir_rvalue::type.

Top-level instructions now get NULL as their default type (since type is
irrelevant for things like ir_function), while ir_rvalues get error_type
by default.

This should make it easier to tell if we've forgotten to set a type. It
also fixes some "Conditional jump or move depends on uninitialized
value" errors in valgrind caused by ir_validate examining the type of
top level ir_instructions, which weren't set.
/external/mesa3d/src/glsl/ir.cpp
9a6d40fbfb679f01412c1fcc9d767c20a22246d8 20-Jul-2010 Kenneth Graunke <kenneth@whitecape.org> ir_constant_expression: Add support for array == and !=.

Piglit parser tests const-array-03.frag and const-array-04.frag now
generate the correct code.
/external/mesa3d/src/glsl/ir.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/ir.cpp
60e2d06d1ccc66ad00cd7ab81c418853f21be291 20-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> glsl2: Implement utility routine to talloc reparent an IR tree
/external/mesa3d/src/glsl/ir.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/ir.cpp
fade78edcbff1e0ae24a1e2c455be2cc7932ee9c 21-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: strdup the field names used in dereference_record.

Otherwise, after linking and freeing the old data, the pointer would
dangle. Partial fix for glsl1-struct*.
/external/mesa3d/src/glsl/ir.cpp
d16044ad4d6176fec6164f96450a25f76b7677f1 19-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Give IR nodes a type field.

This is a big deal for debugging if nothing else ("what class is this
ir_instruction, really?"), but is also nice for avoiding building a
whole visitor or an if (node->as_whatever() || node->as_other_thing())
chain.
/external/mesa3d/src/glsl/ir.cpp
1f47245bdda2c85bf0f0174e6c24a50486b413aa 19-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Remove the const disease from function signature's callee.
/external/mesa3d/src/glsl/ir.cpp
9be7f638130f46a9df2bfbcd4a03b36de9e4f3aa 14-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Make cross() be an expression operation.

ARB_fp, ARB_vp, Mesa IR, and the 965 vertex shader all have
instructions for cross. Shaves 12 Mesa instructions off of a
66-instruction shader I have.
/external/mesa3d/src/glsl/ir.cpp
df05ad4e1aa5512ce1dfd2e6661641e012c8b279 02-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> ir_function_signature: Add method to get the function owning a signature

There is no setter function, the getter returns a constant pointer,
and ir_function_signature::_function is private for a reason. The
only way to make a connection between a function and function
signature is via ir_function::add_signature. This helps ensure that
certain invariants (i.e., a function signature is in the list of
signatures for its _function) are met.
/external/mesa3d/src/glsl/ir.cpp
792e01c1e259077eb339af3ce61905fd227ae4bd 07-Jul-2010 Ian Romanick <ian.d.romanick@intel.com> ir_call: Add method to set the function signature being called
/external/mesa3d/src/glsl/ir.cpp
d925c9173009e9e5d48df30b30aaef22753183aa 01-Jul-2010 Eric Anholt <eric@anholt.net> glsl2: Add ir_unop_fract as an expression type.

Most backends will prefer seeing this to seeing (a - floor(a)), so
represent it explicitly.
/external/mesa3d/src/glsl/ir.cpp
0eda9ae0a6bcd6a7e014df046c87fac5caee0e9e 30-Jun-2010 Eric Anholt <eric@anholt.net> glsl2: Make function names and variable names be children of the node.

This avoids losing their memory when the parser state is freed.
/external/mesa3d/src/glsl/ir.cpp
6315b68f5fbe529bce3497b67c42af1eaa62b8c1 26-Jun-2010 Ian Romanick <ian.d.romanick@intel.com> ir_swizzle: Add new constructor, refactor constructors

Adds a new constructor that takes an array of component values. Refactors
the meat of the two constructors to an init_mask method.
/external/mesa3d/src/glsl/ir.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/ir.cpp