mesa.git
14 years agoMake shader_api.h be C++ friendly
Ian Romanick [Wed, 7 Jul 2010 18:03:21 +0000 (11:03 -0700)]
Make shader_api.h be C++ friendly

14 years agoir_validate: Additional function related invariant checks
Ian Romanick [Fri, 2 Jul 2010 20:30:23 +0000 (13:30 -0700)]
ir_validate: Additional function related invariant checks

Add two invariant checks related to functions and function signatures:

1. Ensure that function definitions (ir_function) are not nested.

2. Ensure that the ir_function pointed to by an ir_function_signature
is the one that contains it in its signatures list.

14 years agoir_function_signature: Add method to get the function owning a signature
Ian Romanick [Fri, 2 Jul 2010 20:28:32 +0000 (13:28 -0700)]
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.

14 years agoglsl2: Add utility function clone_ir_list
Ian Romanick [Tue, 6 Jul 2010 23:01:06 +0000 (16:01 -0700)]
glsl2: Add utility function clone_ir_list

14 years agoir_call: Add method to set the function signature being called
Ian Romanick [Wed, 7 Jul 2010 18:33:13 +0000 (11:33 -0700)]
ir_call: Add method to set the function signature being called

14 years agoglsl2: Implement ir_function::clone and ir_function_signature::clone
Ian Romanick [Wed, 7 Jul 2010 18:02:19 +0000 (11:02 -0700)]
glsl2: Implement ir_function::clone and ir_function_signature::clone

14 years agoglsl2: Move temp declaration to correct side of if-statement in IR
Ian Romanick [Mon, 12 Jul 2010 22:18:55 +0000 (15:18 -0700)]
glsl2: Move temp declaration to correct side of if-statement in IR

14 years agoglsl2: Add missing fields in ir_variable::clone
Ian Romanick [Wed, 7 Jul 2010 23:11:10 +0000 (16:11 -0700)]
glsl2: Add missing fields in ir_variable::clone

14 years agoglsl2: Add declarations for temporaries to instruction stream
Ian Romanick [Mon, 12 Jul 2010 21:22:05 +0000 (14:22 -0700)]
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.

14 years agoglsl2: Store the gl_type of the array's element type in the array.
Eric Anholt [Mon, 12 Jul 2010 21:02:59 +0000 (14:02 -0700)]
glsl2: Store the gl_type of the array's element type in the array.

Fixes glsl-fs-uniform-array-1, glsl-vs-uniform-array-1, and the -2
tests on software.

14 years agoRevert "ir_to_mesa: Add support for adding/subtracting matrices."
Eric Anholt [Mon, 12 Jul 2010 19:03:33 +0000 (12:03 -0700)]
Revert "ir_to_mesa: Add support for adding/subtracting matrices."

This reverts commit b4d0c0e0ee983ee614b047799c3e01221a353c98.
Now that ir_mat_op_to_vec is landed, this change is no longer needed.

14 years agoglsl2: Add a new pass at the IR level to break down matrix ops to vector ops.
Eric Anholt [Mon, 12 Jul 2010 18:04:07 +0000 (11:04 -0700)]
glsl2: Add a new pass at the IR level to break down matrix ops to vector ops.

This will be used by the Mesa IR and likely most HW backends, as it
allows other optimizations to occur that might not otherwise.

Fixes glsl-vs-mat-sub-1, glsl-vs-mat-div-1.

14 years agoglsl2: Flatten out expressions that are the child of an assignment rhs.
Eric Anholt [Mon, 12 Jul 2010 17:48:22 +0000 (10:48 -0700)]
glsl2: Flatten out expressions that are the child of an assignment rhs.

This feels a little odd, but it will be useful for ir_mat_to_vec,
where I want to see a plain assignment of the expression to a
variable, not to a writemasked array dereference with a call as the
array index.

14 years agoglsl2: Check when inlining a bare function call that it actually is.
Eric Anholt [Mon, 12 Jul 2010 17:13:20 +0000 (10:13 -0700)]
glsl2: Check when inlining a bare function call that it actually is.

It would be easy to miss an entry either of the two visitors involved
that would result in trying to ir->remove() the call to remove it from
the instruction stream when really it's part of an expression tree
that wasn't flattened.

14 years agoast_function: Fix non-float constructors with matrix arguments.
Kenneth Graunke [Fri, 9 Jul 2010 01:15:32 +0000 (18:15 -0700)]
ast_function: Fix non-float constructors with matrix arguments.

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

Fixes piglit tests constructor-11.vert, constructor-14.vert,
constructor-15.vert, and CorrectConstFolding2.frag.

14 years agoast_function: Move error return earlier and don't indent the world.
Kenneth Graunke [Fri, 9 Jul 2010 01:03:28 +0000 (18:03 -0700)]
ast_function: Move error return earlier and don't indent the world.

This has no functional changes.

14 years agoast_function: Remove unnecessary check for empty constructors.
Kenneth Graunke [Fri, 9 Jul 2010 00:59:56 +0000 (17:59 -0700)]
ast_function: Remove unnecessary check for empty constructors.

This case is already caught by a later check that ensures sufficient
components were provided, based on the type.

14 years agoglsl2: Use new foreach_list_safe abstraction.
Kenneth Graunke [Thu, 8 Jul 2010 20:08:14 +0000 (13:08 -0700)]
glsl2: Use new foreach_list_safe abstraction.

14 years agoglsl2: Add foreach_list_safe which works even when mutating the list.
Kenneth Graunke [Thu, 8 Jul 2010 20:06:22 +0000 (13:06 -0700)]
glsl2: Add foreach_list_safe which works even when mutating the list.

In particular, with foreach_list_safe, one can remove and free the current
node without crashes; if new nodes are added after the current node,
they will be properly visited as well.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
14 years agoglsl2: Remove generate_temporary and global temporary counter.
Kenneth Graunke [Thu, 8 Jul 2010 19:40:52 +0000 (12:40 -0700)]
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...)

14 years agomesa: Extend register lifetimes to the end of the largest loop required.
Eric Anholt [Thu, 8 Jul 2010 04:28:28 +0000 (21:28 -0700)]
mesa: Extend register lifetimes to the end of the largest loop required.

Previously, a register defined at main scope and used in a loop in a
loop could end up getting marked as needed only from the definition
outside of the loops to the end of the inner loop, and we would
cleverly slot in something else in its register in the end of the
outer loop.

Fixes glsl-vs-loop-nested and glsl-fs-loop-nested on glsl2.  This
doesn't happen much on master because the original compiler does its
own register allocation, so we find little we can do with linear scan
register (re)allocation.

14 years agomesa: Fix documentation of BranchTarget for BRK.
Eric Anholt [Thu, 8 Jul 2010 04:00:32 +0000 (21:00 -0700)]
mesa: Fix documentation of BranchTarget for BRK.

It was changed in 2009 and the comment wasn't updated.

14 years agoglsl2: Add support for gl_PointCoord in 1.20.
Eric Anholt [Thu, 8 Jul 2010 02:45:22 +0000 (19:45 -0700)]
glsl2: Add support for gl_PointCoord in 1.20.

Fixes glsl-fs-pointcoord on swrast (remains broken on 965, like master)

14 years agoir_to_mesa: Fix the assertion on LHS array derefs to DWIM.
Eric Anholt [Thu, 8 Jul 2010 00:59:50 +0000 (17:59 -0700)]
ir_to_mesa: Fix the assertion on LHS array derefs to DWIM.

This allows array derefs of matrices now, which makes idr's GLSL demo
happy.

14 years agoir_to_mesa: Add support for constant matrices (untested).
Eric Anholt [Thu, 8 Jul 2010 00:49:05 +0000 (17:49 -0700)]
ir_to_mesa: Add support for constant matrices (untested).

14 years agoir_to_mesa: Add support for adding/subtracting matrices.
Eric Anholt [Thu, 8 Jul 2010 00:08:58 +0000 (17:08 -0700)]
ir_to_mesa: Add support for adding/subtracting matrices.

This isn't really tested, but didn't break normal vector add/sub.

14 years agoir_to_mesa: Don't assert that we can't assign matrices. It should work now.
Eric Anholt [Thu, 8 Jul 2010 00:24:00 +0000 (17:24 -0700)]
ir_to_mesa: Don't assert that we can't assign matrices.  It should work now.

14 years agoir_to_mesa: Only allocate a vector per column of a matrix.
Eric Anholt [Wed, 7 Jul 2010 23:16:09 +0000 (16:16 -0700)]
ir_to_mesa: Only allocate a vector per column of a matrix.

14 years agoir_to_mesa: Add support for assignment of aggregates.
Eric Anholt [Wed, 7 Jul 2010 23:10:04 +0000 (16:10 -0700)]
ir_to_mesa: Add support for assignment of aggregates.

14 years agoir_to_mesa: Add support for matrix * matrix.
Eric Anholt [Wed, 7 Jul 2010 22:55:47 +0000 (15:55 -0700)]
ir_to_mesa: Add support for matrix * matrix.

14 years agoir_reader: Don't emit ir_function multiple times.
Kenneth Graunke [Wed, 7 Jul 2010 22:23:27 +0000 (15:23 -0700)]
ir_reader: Don't emit ir_function multiple times.

14 years agolinker: Use bit-0 instead of VERT_BIT_GENERIC0
Ian Romanick [Wed, 7 Jul 2010 23:28:39 +0000 (16:28 -0700)]
linker: Use bit-0 instead of VERT_BIT_GENERIC0

Uses of the bits for allocation are offset by 16, and
VERT_BIT_GENERIC0 already has the 16 offset.  As a result, it was
preventing the wrong thing from being allocated.

14 years agoglsl: Fix the setup of refract()'s output for vec3/vec4 and k < 0.0.
Eric Anholt [Wed, 7 Jul 2010 21:53:43 +0000 (14:53 -0700)]
glsl: Fix the setup of refract()'s output for vec3/vec4 and k < 0.0.

caught by valgrind.

14 years agoglsl2: Fix ir_div_to_mul_rcp for integer division.
Eric Anholt [Wed, 7 Jul 2010 19:25:22 +0000 (12:25 -0700)]
glsl2: Fix ir_div_to_mul_rcp for integer division.

rcp of an integer value did not produce the result you're looking for.
Instead, do the a * rcp(b) as float and truncate after.  This mostly
fixes glsl-fs-loop-nested.

14 years agoglsl2: Actually add the declaration of _post_incdec_temp.
Eric Anholt [Wed, 7 Jul 2010 21:04:30 +0000 (14:04 -0700)]
glsl2: Actually add the declaration of _post_incdec_temp.

14 years agoir_constant_expression: Fix loop increments.
Kenneth Graunke [Wed, 7 Jul 2010 19:08:23 +0000 (12:08 -0700)]
ir_constant_expression: Fix loop increments.

14 years agoglsl2: Initialize yylineno and yycolumn so line numbers are sane.
Kenneth Graunke [Wed, 7 Jul 2010 18:40:51 +0000 (11:40 -0700)]
glsl2: Initialize yylineno and yycolumn so line numbers are sane.

14 years agoglsl2: Put the initializer in the instruction stream after the declaration
Ian Romanick [Wed, 7 Jul 2010 19:13:34 +0000 (12:13 -0700)]
glsl2: Put the initializer in the instruction stream after the declaration

14 years agoexec_list: Add method to append one complete list to another
Ian Romanick [Wed, 7 Jul 2010 19:12:48 +0000 (12:12 -0700)]
exec_list: Add method to append one complete list to another

14 years agoRevert "glsl2: Put the declaration in the instruction stream before its initializer."
Ian Romanick [Wed, 7 Jul 2010 18:57:16 +0000 (11:57 -0700)]
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.

14 years agoir_to_mesa: Add support for gl_TextureMatrix access.
Eric Anholt [Wed, 7 Jul 2010 18:39:48 +0000 (11:39 -0700)]
ir_to_mesa: Add support for gl_TextureMatrix access.

Fixes glsl-vs-texturematrix-1, and glsl-vs-texturematrix-2 on swrast.

14 years agoir_to_mesa: Fill in some uninitialized fields that sometimes contained junk.
Eric Anholt [Wed, 7 Jul 2010 18:38:55 +0000 (11:38 -0700)]
ir_to_mesa: Fill in some uninitialized fields that sometimes contained junk.

14 years agoglsl2: Add a pass to simplify if statements returning from both sides.
Eric Anholt [Wed, 7 Jul 2010 01:09:39 +0000 (18:09 -0700)]
glsl2: Add a pass to simplify if statements returning from both sides.

This allows function inlining making the following tests work even
without function calls implemented:
glsl-fs-functions-2
glsl-fs-functions-3
glsl-vs-functions
glsl-vs-functions-2
glsl-vs-functions-3
glsl-vs-vec4-indexing-5

(Note that those tests were designed to trigger actual function calls,
and this defeats them.  However, those testcases ended up catching the
bug in the previous commit.)

14 years agoglsl2: Clean up vec_index_to_cond_assign after the clone return type change.
Eric Anholt [Wed, 7 Jul 2010 15:39:09 +0000 (08:39 -0700)]
glsl2: Clean up vec_index_to_cond_assign after the clone return type change.

14 years agoglsl2: Don't forget to walk the parameters to a function in the hv.
Eric Anholt [Wed, 7 Jul 2010 15:38:16 +0000 (08:38 -0700)]
glsl2: Don't forget to walk the parameters to a function in the hv.

Fixes segfaults from use after free after the steal of ir nodes and
free of the compile context.

14 years agoglsl2: Avoid null deref in scalar constant unop expressions.
Eric Anholt [Wed, 7 Jul 2010 16:07:09 +0000 (09:07 -0700)]
glsl2: Avoid null deref in scalar constant unop expressions.

14 years agoglsl2: Put the declaration in the instruction stream before its initializer.
Eric Anholt [Wed, 7 Jul 2010 01:31:32 +0000 (18:31 -0700)]
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.

14 years agoglsl2: Add pass for supporting variable vector indexing in rvalues.
Eric Anholt [Wed, 7 Jul 2010 00:53:32 +0000 (17:53 -0700)]
glsl2: Add pass for supporting variable vector indexing in rvalues.

The Mesa IR needs this to support vector indexing correctly, and
hardware backends such as 915 would want this behavior as well.

Fixes glsl-vs-vec4-indexing-2.

14 years agoir_to_mesa: Add support for conditional moves.
Eric Anholt [Wed, 7 Jul 2010 00:11:03 +0000 (17:11 -0700)]
ir_to_mesa: Add support for conditional moves.

Nothing generates conditional moves yet.

14 years agoglsl2: Clone methods return the type of the thing being cloned
Ian Romanick [Wed, 7 Jul 2010 00:41:02 +0000 (17:41 -0700)]
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.

14 years agoir_constant_expression: Declare loop counting variables in the loops.
Kenneth Graunke [Tue, 6 Jul 2010 23:26:11 +0000 (16:26 -0700)]
ir_constant_expression: Declare loop counting variables in the loops.

Fixes "name lookup of 'c' changed" warning.

14 years agoglsl2: Update TODO.
Kenneth Graunke [Tue, 6 Jul 2010 11:59:08 +0000 (04:59 -0700)]
glsl2: Update TODO.

14 years agoir_constant_expression: Add support for dot products.
Kenneth Graunke [Tue, 6 Jul 2010 04:15:32 +0000 (21:15 -0700)]
ir_constant_expression: Add support for dot products.

14 years agoir_constant_expression: Add support for matrix multiplication.
Kenneth Graunke [Tue, 6 Jul 2010 06:19:56 +0000 (23:19 -0700)]
ir_constant_expression: Add support for matrix multiplication.

Also handles matrix/vector and vector/matrix multiplication.

Fixes piglit tests const-matrix-multiply-01.frag,
const-matrix-multiply-02.frag, and const-vec-mat.frag.

14 years agoir_constant_expression: Support scalar * vector and scalar * matrix.
Kenneth Graunke [Tue, 6 Jul 2010 10:01:15 +0000 (03:01 -0700)]
ir_constant_expression: Support scalar * vector and scalar * matrix.

The test here is slightly different since we need to keep matrix
multiplication separate.

Fixes piglit tests const-vec-scalar-03.frag and const-mat-scalar-03.frag.

14 years agoir_constant_expression: Support scalar / vector and scalar / matrix.
Kenneth Graunke [Tue, 6 Jul 2010 09:56:36 +0000 (02:56 -0700)]
ir_constant_expression: Support scalar / vector and scalar / matrix.

Fixes piglit tests const-vec-scalar-04.frag and const-mat-scalar-04.frag.

14 years agoir_constant_expression: Support scalar - vector and scalar - matrix.
Kenneth Graunke [Tue, 6 Jul 2010 09:53:29 +0000 (02:53 -0700)]
ir_constant_expression: Support scalar - vector and scalar - matrix.

Fixes piglit tests const-vec-scalar-02.frag and const-mat-scalar-02.frag.

14 years agoir_constant_expression: Support scalar + vector and scalar + matrix.
Kenneth Graunke [Tue, 6 Jul 2010 09:48:16 +0000 (02:48 -0700)]
ir_constant_expression: Support scalar + vector and scalar + matrix.

Fixes piglit tests const-vec-scalar-01.frag, const-vec-scalar-05.frag,
and const-mat-scalar-01.frag.

14 years agoir_constant_expression: Assert that both operands share a base type.
Kenneth Graunke [Tue, 6 Jul 2010 09:39:57 +0000 (02:39 -0700)]
ir_constant_expression: Assert that both operands share a base type.

14 years agoir_constant_expression: Initialize op[0] and op[1] to NULL.
Kenneth Graunke [Sat, 3 Jul 2010 00:12:23 +0000 (17:12 -0700)]
ir_constant_expression: Initialize op[0] and op[1] to NULL.

This makes it easy to check if there is a second argument.

14 years agoir_constant_expression: Initialize all components of constant data to 0.
Kenneth Graunke [Tue, 6 Jul 2010 05:33:35 +0000 (22:33 -0700)]
ir_constant_expression: Initialize all components of constant data to 0.

This is probably just a good idea, and will come in useful when
implementing things like matrix multiplication.

14 years agoAdd hash table helper functions for using pointers as hash keys
Ian Romanick [Tue, 6 Jul 2010 21:49:14 +0000 (14:49 -0700)]
Add hash table helper functions for using pointers as hash keys

14 years agoMake hashtable.h be C++ friendly
Ian Romanick [Tue, 6 Jul 2010 21:36:54 +0000 (14:36 -0700)]
Make hashtable.h be C++ friendly

14 years agoir_to_mesa: Use the compiler-assigned locations for builtin attrs/varyings.
Eric Anholt [Tue, 6 Jul 2010 19:28:12 +0000 (12:28 -0700)]
ir_to_mesa: Use the compiler-assigned locations for builtin attrs/varyings.

The previous table didn't distinguish gl_Color for the VS and FS, so
we would use the FS's attribute index for the VS and read undefined.
This partially fixes glsl-routing to match its behavior on master.

14 years agoRefresh autogenerated file builtin_function.cpp.
Kenneth Graunke [Sat, 3 Jul 2010 01:20:19 +0000 (18:20 -0700)]
Refresh autogenerated file builtin_function.cpp.

14 years agoglcpp: Add #error support.
Kenneth Graunke [Fri, 2 Jul 2010 22:31:26 +0000 (15:31 -0700)]
glcpp: Add #error support.

14 years agoglsl2: Fix for dead strings being stored in the symbol table.
Kenneth Graunke [Fri, 2 Jul 2010 22:02:57 +0000 (15:02 -0700)]
glsl2: Fix for dead strings being stored in the symbol table.

14 years agoir_to_mesa: Fix uninitalized value.
Kenneth Graunke [Fri, 2 Jul 2010 09:50:40 +0000 (02:50 -0700)]
ir_to_mesa: Fix uninitalized value.

14 years agoglsl2/builtins: Use vector ops in the 130 version of "sign."
Kenneth Graunke [Fri, 2 Jul 2010 09:12:34 +0000 (02:12 -0700)]
glsl2/builtins: Use vector ops in the 130 version of "sign."

14 years agoglsl2/builtins: Use vector ops in "smoothstep."
Kenneth Graunke [Fri, 2 Jul 2010 09:10:01 +0000 (02:10 -0700)]
glsl2/builtins: Use vector ops in "smoothstep."

14 years agoir_to_mesa: Fix up implementation of ir_unop_exp.
Eric Anholt [Sat, 3 Jul 2010 00:02:42 +0000 (17:02 -0700)]
ir_to_mesa: Fix up implementation of ir_unop_exp.

OPCODE_EXP is not to ir_unop_exp what OPCODE_EX2 is to ir_unop_exp2.
It's the weird VP approximation helper opcode.  Just implement it with
OPCODE_POW instead.

Fixes glsl-fs-exp.

14 years agoi965: Add support for the DP2 opcode, which we use for dot(vec2, vec2).
Eric Anholt [Fri, 2 Jul 2010 23:17:50 +0000 (16:17 -0700)]
i965: Add support for the DP2 opcode, which we use for dot(vec2, vec2).

The original glsl compiler would generate a.x * b.x + a.y * b.y, which
we would do mul+mul+add for instead of this mul+mac.

Fixes glsl-fs-dot-vec2.

14 years agoir_to_mesa: Add support for scalar * mat, vec * mat.
Eric Anholt [Fri, 2 Jul 2010 23:10:31 +0000 (16:10 -0700)]
ir_to_mesa: Add support for scalar * mat, vec * mat.

This is not tested by piglit currently.

14 years agoir_to_mesa: Add support for shadow comparison to texture instructions.
Eric Anholt [Fri, 2 Jul 2010 23:09:44 +0000 (16:09 -0700)]
ir_to_mesa: Add support for shadow comparison to texture instructions.

piglit lacks tests for this currently.

14 years agoir_to_mesa: Move projection handling out of ir_tex so txb and txl get it.
Eric Anholt [Fri, 2 Jul 2010 22:37:24 +0000 (15:37 -0700)]
ir_to_mesa: Move projection handling out of ir_tex so txb and txl get it.

Fixes:
glsl-fs-texture2dproj-bias
glsl-fs-texture2dproj-bias-2

14 years agoglsl2: Print the linking info log in the stand-alone compiler
Ian Romanick [Fri, 2 Jul 2010 21:43:01 +0000 (14:43 -0700)]
glsl2: Print the linking info log in the stand-alone compiler

14 years agoir_to_mesa: Add support for projected non-shadow/bias/lod texturing.
Eric Anholt [Fri, 2 Jul 2010 21:49:29 +0000 (14:49 -0700)]
ir_to_mesa: Add support for projected non-shadow/bias/lod texturing.

Fixes:
glsl-fs-texture2dproj
glsl-fs-texture2dproj-2

14 years agoir_to_mesa: Fix sparse swizzling of src regs when a writemask is present.
Eric Anholt [Fri, 2 Jul 2010 21:06:34 +0000 (14:06 -0700)]
ir_to_mesa: Fix sparse swizzling of src regs when a writemask is present.

Fixes glsl-fs-texture2d-masked.

14 years agoir_to_mesa: Don't forget to run the Mesa IR optimization passes.
Eric Anholt [Fri, 2 Jul 2010 18:37:39 +0000 (11:37 -0700)]
ir_to_mesa: Don't forget to run the Mesa IR optimization passes.

With how we generate assignments, the trivial copy propagation in it
is really important, and some drivers will really want the register
allocation, too.

14 years agoglsl2: Add a pass to break ir_binop_div to _mul and _rcp.
Eric Anholt [Fri, 2 Jul 2010 18:27:06 +0000 (11:27 -0700)]
glsl2: Add a pass to break ir_binop_div to _mul and _rcp.

This results in constant folding of a constant divisor.

14 years agoglsl2: Conditionally allow optional extensions to be enabled
Ian Romanick [Wed, 30 Jun 2010 23:42:07 +0000 (16:42 -0700)]
glsl2: Conditionally allow optional extensions to be enabled

The only optional extension currently supported by the compiler is
GL_EXT_texture_array.

14 years agoglsl2: Append _TOK to some parser tokens
Ian Romanick [Wed, 30 Jun 2010 23:40:47 +0000 (16:40 -0700)]
glsl2: Append _TOK to some parser tokens

This prevents conflicts with defines elsewhere in Mesa and allows
including mtypes.h in the compiler.

14 years agoglsl2: Conditionally define preprocessor tokens for optional extensions
Ian Romanick [Wed, 30 Jun 2010 23:27:22 +0000 (16:27 -0700)]
glsl2: Conditionally define preprocessor tokens for optional extensions

The only optional extension currently supported by the compiler is
GL_EXT_texture_array.

14 years agoglsl2: Define preprocessor tokens for extensions
Ian Romanick [Wed, 30 Jun 2010 23:03:19 +0000 (16:03 -0700)]
glsl2: Define preprocessor tokens for extensions

Currently only GL_ARB_draw_buffers and GL_ARB_texture_rectangle are
defined because those extensions are always enabled.  This make
tex_rect-03.frag pass.

14 years agoglsl2: Support AST-to-IR translation of invariant keyword
Ian Romanick [Fri, 2 Jul 2010 03:39:08 +0000 (20:39 -0700)]
glsl2: Support AST-to-IR translation of invariant keyword

14 years agoglsl2: Initialize ast_declarator_list::invariant in constructor
Ian Romanick [Fri, 2 Jul 2010 00:10:11 +0000 (17:10 -0700)]
glsl2: Initialize ast_declarator_list::invariant in constructor

14 years agoglsl2: Don't bounds check unsize array redeclarations
Ian Romanick [Thu, 1 Jul 2010 21:10:19 +0000 (14:10 -0700)]
glsl2: Don't bounds check unsize array redeclarations

This along with several previous commits fix test CorrectUnsizedArray.frag.

14 years agoglsl2: Add gl_MaxTextureCoords
Ian Romanick [Thu, 1 Jul 2010 20:30:50 +0000 (13:30 -0700)]
glsl2: Add gl_MaxTextureCoords

14 years agoglsl2: Default delcaration of gl_TexCoord is unsized
Ian Romanick [Thu, 1 Jul 2010 20:17:54 +0000 (13:17 -0700)]
glsl2: Default delcaration of gl_TexCoord is unsized

14 years agoglsl2: Change order of semaintic checks on variable declarations
Ian Romanick [Thu, 1 Jul 2010 19:46:55 +0000 (12:46 -0700)]
glsl2: Change order of semaintic checks on variable declarations

This will make it easier to support more (valid) kinds of redeclarations.

14 years agoir_to_mesa: Fill in remaining ops, remove default case for expression types.
Eric Anholt [Thu, 1 Jul 2010 18:24:38 +0000 (11:24 -0700)]
ir_to_mesa: Fill in remaining ops, remove default case for expression types.

We should now have support for all the expression types we need for
GLSL 1.20.

14 years agoir_to_mesa: Add support for ir_unop_rcp.
Eric Anholt [Thu, 1 Jul 2010 18:23:02 +0000 (11:23 -0700)]
ir_to_mesa: Add support for ir_unop_rcp.

This isn't used at the moment, but will be soon.

14 years agoglsl2: Update README for what I've been thinking about with expr types work.
Eric Anholt [Thu, 1 Jul 2010 17:32:30 +0000 (10:32 -0700)]
glsl2: Update README for what I've been thinking about with expr types work.

14 years agoglsl2: Add a pass to convert mod(a, b) to b * fract(a/b).
Eric Anholt [Thu, 1 Jul 2010 17:09:58 +0000 (10:09 -0700)]
glsl2: Add a pass to convert mod(a, b) to b * fract(a/b).

This is used by the Mesa IR backend to implement mod, fixing glsl-fs-mod.

14 years agoglsl2: Remove dead member from dead code visitor.
Eric Anholt [Thu, 1 Jul 2010 17:52:30 +0000 (10:52 -0700)]
glsl2: Remove dead member from dead code visitor.

14 years agoglsl2: Add ir_unop_fract as an expression type.
Eric Anholt [Thu, 1 Jul 2010 17:37:11 +0000 (10:37 -0700)]
glsl2: Add ir_unop_fract as an expression type.

Most backends will prefer seeing this to seeing (a - floor(a)), so
represent it explicitly.

14 years agoir_to_mesa: Add support for discard instructions.
Eric Anholt [Thu, 1 Jul 2010 00:31:06 +0000 (17:31 -0700)]
ir_to_mesa: Add support for discard instructions.

Fixes glsl-fs-discard-01.

14 years agoglsl2: Don't break sign() down by vector components.
Eric Anholt [Thu, 1 Jul 2010 00:25:09 +0000 (17:25 -0700)]
glsl2: Don't break sign() down by vector components.

14 years agoir_to_mesa: Add support for ir_unop_sign.
Eric Anholt [Thu, 1 Jul 2010 00:06:06 +0000 (17:06 -0700)]
ir_to_mesa: Add support for ir_unop_sign.

Fixes glsl-fs-sign, glsl-vs-sign.

14 years agoi965: Add support for OPCODE_SSG.
Eric Anholt [Thu, 1 Jul 2010 00:05:11 +0000 (17:05 -0700)]
i965: Add support for OPCODE_SSG.

The old compiler didn't use SSG, and instead emitted SGT/SGT/SUB.  We
can do a little better for SSG than we do for the SGT series.