profile/ivi/mesa.git
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.

14 years agoir_to_mesa: Add missing no-op type conversions.
Eric Anholt [Wed, 30 Jun 2010 23:23:32 +0000 (16:23 -0700)]
ir_to_mesa: Add missing no-op type conversions.

Fixes glsl-fs-step.

14 years agoglsl2: Fix reversed value of step().
Eric Anholt [Wed, 30 Jun 2010 23:22:52 +0000 (16:22 -0700)]
glsl2: Fix reversed value of step().

It's 0.0 if x < edge, not 1.0.  Partial fix for glsl-fs-step.

14 years agoir_to_mesa: Note which of our expr ops are unsupported 1.30 features.
Eric Anholt [Wed, 30 Jun 2010 23:18:06 +0000 (16:18 -0700)]
ir_to_mesa: Note which of our expr ops are unsupported 1.30 features.

14 years agoglsl2: Fix up the implementation of fract() for vector types.
Eric Anholt [Wed, 30 Jun 2010 22:59:07 +0000 (15:59 -0700)]
glsl2: Fix up the implementation of fract() for vector types.

There's no need to split each vector component out, just do vector ops.

14 years agoir_to_mesa: Initialize the (we never use it) abs field of Mesa src regs.
Eric Anholt [Wed, 30 Jun 2010 22:49:04 +0000 (15:49 -0700)]
ir_to_mesa: Initialize the (we never use it) abs field of Mesa src regs.

14 years agoir_to_mesa: Send the negate field on to Mesa IR.
Eric Anholt [Wed, 30 Jun 2010 22:44:01 +0000 (15:44 -0700)]
ir_to_mesa: Send the negate field on to Mesa IR.

Fixes glsl-fs-neg.

14 years agoir_to_mesa: When generating a swizzle, respect the reg's current swizzle.
Eric Anholt [Wed, 30 Jun 2010 22:26:41 +0000 (15:26 -0700)]
ir_to_mesa: When generating a swizzle, respect the reg's current swizzle.

Fixes depth-tex-modes-glsl.

14 years agoglsl2: Implement AST->HIR support for the "discard" instruction.
Kenneth Graunke [Wed, 30 Jun 2010 21:11:00 +0000 (14:11 -0700)]
glsl2: Implement AST->HIR support for the "discard" instruction.

14 years agoglsl2: Define new ir_discard instruction.
Kenneth Graunke [Wed, 30 Jun 2010 17:47:34 +0000 (10:47 -0700)]
glsl2: Define new ir_discard instruction.

14 years agoir_to_mesa: Support gl_FragDepth.
Eric Anholt [Wed, 30 Jun 2010 21:55:45 +0000 (14:55 -0700)]
ir_to_mesa: Support gl_FragDepth.

Fixes glsl-bug-22603.

14 years agoglsl2: Allow a fragment shader to not write a color.
Eric Anholt [Wed, 30 Jun 2010 21:51:50 +0000 (14:51 -0700)]
glsl2: Allow a fragment shader to not write a color.

I can't find any text justifying this check, and it caused a
reasonable-looking shader in glsl-bug-22603 (which writes only
gl_FragDepth) to fail.

14 years agomesa: Don't look in unallocatd param slots for parameter values.
Eric Anholt [Wed, 30 Jun 2010 21:28:38 +0000 (14:28 -0700)]
mesa: Don't look in unallocatd param slots for parameter values.

glsl-derivs would add 40.0, 0.0, and 1.0 in order.  When we went
looking for 0.0, we'd find it in the second slot of the param, and use
it, but param->Size would still be 1.  When we went to add 1.0 and
didn't find it, we'd put allocate it to that second slot and the 0.0
would actualy end up being 1.0.

Fixes glsl-derivs, glsl-deriv-varyings.

14 years agoir_to_mesa: Fix the indexing of attributes in the program's Attributes.
Eric Anholt [Wed, 30 Jun 2010 21:01:43 +0000 (14:01 -0700)]
ir_to_mesa: Fix the indexing of attributes in the program's Attributes.

This fixes GetAttribLocation returning VERT_ATTRIB_GENERIC1 instead of 1,
caught by glsl-dlist-getattriblocation.

14 years agoglsl2: Fix storing of dead memory in the symbol table.
Kenneth Graunke [Wed, 30 Jun 2010 18:57:43 +0000 (11:57 -0700)]
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.

14 years agoglsl2: Preprocessed source doesn't need to live past compile time.
Kenneth Graunke [Tue, 29 Jun 2010 18:31:04 +0000 (11:31 -0700)]
glsl2: Preprocessed source doesn't need to live past compile time.

14 years agoglsl2: Create new talloc contexts the "right" way.
Kenneth Graunke [Fri, 25 Jun 2010 20:36:14 +0000 (13:36 -0700)]
glsl2: Create new talloc contexts the "right" way.

14 years agoglsl2: Use _mesa_glsl_parse_state as the talloc parent, not glsl_shader.
Kenneth Graunke [Fri, 25 Jun 2010 20:14:37 +0000 (13:14 -0700)]
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.

14 years agoglsl2: Steal the live IR and free the rest of the junk.
Kenneth Graunke [Fri, 25 Jun 2010 21:10:01 +0000 (14:10 -0700)]
glsl2: Steal the live IR and free the rest of the junk.

14 years agolinker: Don't dynamically allocate slots for linked shaders
Ian Romanick [Wed, 30 Jun 2010 00:58:43 +0000 (17:58 -0700)]
linker: Don't dynamically allocate slots for linked shaders

The can be at most one shader per stage.  There are currently only two
stages.  There is zero reason to dynamically size this array.

14 years agoir_to_mesa: Tell Mesa about our choices for vertex attribute locations.
Eric Anholt [Wed, 30 Jun 2010 01:23:05 +0000 (18:23 -0700)]
ir_to_mesa: Tell Mesa about our choices for vertex attribute locations.

14 years agolinker: Don't automatically allocate VERT_ATTRIB_GENERIC0
Ian Romanick [Wed, 30 Jun 2010 01:58:20 +0000 (18:58 -0700)]
linker: Don't automatically allocate VERT_ATTRIB_GENERIC0

14 years agoglsl2: Use Mesa's gl_shader_program instead of our own struct glsl_program.
Eric Anholt [Wed, 30 Jun 2010 18:49:17 +0000 (11:49 -0700)]
glsl2: Use Mesa's gl_shader_program instead of our own struct glsl_program.

This avoids more allocation and shuffling of data around.

14 years agoglsl2: Make function names and variable names be children of the node.
Eric Anholt [Wed, 30 Jun 2010 18:51:54 +0000 (11:51 -0700)]
glsl2: Make function names and variable names be children of the node.

This avoids losing their memory when the parser state is freed.

14 years agoglsl2: Move our data from a glsl_shader* on the side to the main gl_shader *.
Eric Anholt [Wed, 30 Jun 2010 18:05:43 +0000 (11:05 -0700)]
glsl2: Move our data from a glsl_shader* on the side to the main gl_shader *.

This saves recompiling at link time.  gl_shader->ir is made a pointer
so that we don't have to bring exec_list into mtypes.h.

14 years agoir_to_mesa: Add support for ir_unop_abs.
Eric Anholt [Tue, 29 Jun 2010 23:39:38 +0000 (16:39 -0700)]
ir_to_mesa: Add support for ir_unop_abs.

14 years agoir_to_mesa: Add support for dFdx, dFdy.
Eric Anholt [Tue, 29 Jun 2010 23:36:42 +0000 (16:36 -0700)]
ir_to_mesa: Add support for dFdx, dFdy.

14 years agoir_to_mesa: Start adding support for texture instructions.
Eric Anholt [Tue, 29 Jun 2010 21:16:11 +0000 (14:16 -0700)]
ir_to_mesa: Start adding support for texture instructions.

Fixes:
glsl-fs-bug25902
glsl-fs-sampler-numbering
glsl-lod-bias

14 years agoglsl2: Keep the same number of components in implicit conversions.
Kenneth Graunke [Tue, 29 Jun 2010 22:59:27 +0000 (15:59 -0700)]
glsl2: Keep the same number of components in implicit conversions.

Fixes piglit test glsl-implicit-conversion-01.

14 years agoglsl2: Make gl_MaxDrawBuffers available in the vertex shader
Ian Romanick [Tue, 29 Jun 2010 22:29:56 +0000 (15:29 -0700)]
glsl2: Make gl_MaxDrawBuffers available in the vertex shader

14 years agoglsl2: Make gl_MaxDrawBuffers available in the fragment shader
Ian Romanick [Tue, 29 Jun 2010 22:19:11 +0000 (15:19 -0700)]
glsl2: Make gl_MaxDrawBuffers available in the fragment shader