summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* ir_constant_expression: Fix broken code for floating point modulus.Kenneth Graunke2010-07-221-1/+1
| | | | It's supposed to be x - y * floor(x/y), not (x - y) * floor(x/y).
* glsl2: Refresh autogenerated file builtin_function.cpp.Kenneth Graunke2010-07-221-25/+47
|
* glsl2/builtins: Add 1.30 bvec variant of the "mix" builtin.Kenneth Graunke2010-07-221-0/+39
|
* glsl2/builtins: Fix 1.30 sign implementation for ints.Kenneth Graunke2010-07-221-1/+1
|
* glsl2/builtins: Fix "mod" builtin to use scalar/vector operations.Kenneth Graunke2010-07-221-24/+3
|
* glsl2: Initialize ir_instruction::type and ir_rvalue::type.Kenneth Graunke2010-07-222-4/+7
| | | | | | | | | | | 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.
* glsl2: Make ir_assignment derive from ir_instruction, not ir_rvalue.Kenneth Graunke2010-07-222-3/+3
| | | | | | Assignments can only exist at the top level instruction stream; the residual value is handled by assigning the value to a temporary and returning an ir_dereference_variable of that temporary.
* glsl2: Fix standalone compiler to not crash horribly.Kenneth Graunke2010-07-222-41/+27
| | | | | ir_to_mesa was updated for the _mesa_glsl_parse_state constructor changes, but main.cpp was not.
* ir_print_visitor: Add "temporary" to mode string printing.Kenneth Graunke2010-07-221-1/+2
| | | | | | Variables with mode ir_var_temporary were causing an out of bounds array access and filling my screen with rubbish. I'm not sure if "temporary" is the right thing to print.
* glcpp: Fix function-like macros with an argument used multiple times.Carl Worth2010-07-222-3/+9
| | | | | | | | | | | It's really hard to believe that this case has been broken, but apparently no test previously exercised it. So this commit adds such a test and fixes it by making a copy of the argument token-list before expanding it. This fix causes the following glean tests to now pass: glsl1-Preprocessor test 6 (#if 0, #define macro) glsl1-Preprocessor test 7 (multi-line #define)
* glsl2: Put side effects of the RHS of logic_or in the right branch.Eric Anholt2010-07-221-1/+1
| | | | | | | | Kind of missing the point to only do the side effects if the LHS evaluates as true. Fixes: glsl1-|| operator, short-circuit
* glsl2: Validate that ir_if conditions are actually bool.Eric Anholt2010-07-221-0/+13
|
* ir_to_mesa: Fix the swizzles on record and array dereferences.Eric Anholt2010-07-221-3/+9
| | | | | | | | Fixes: glsl1-struct (1) glsl1-struct (2) glsl1-struct (3) glsl1-struct (4)
* glsl2: When setting the size of an unsized array, set its deref's size too.Eric Anholt2010-07-221-0/+1
|
* glsl2: Set the type on cloned tex instructions.Eric Anholt2010-07-221-0/+1
|
* glsl2: Add the API defines to the glsl2 build so we get the right GLcontextEric Anholt2010-07-221-2/+6
| | | | | | | Fixes: draw_buffers-08.frag draw_buffers-09.frag glsl-vs-texturematrix-2
* glsl2: Fix builtin prototypes defined in multiple glsl/builtins/* filesEric Anholt2010-07-221-10/+11
| | | | | | | | | | | | If we put the protos in separate ir_functions, they wouldn't be found at lookup time for linking. Fixes: glsl-fs-texture2d-bias glsl-fs-texture2dproj-bias glsl-fs-texture2dproj-bias-2 glsl-lod-bias glsl1-texture2D(), computed coordinate
* glsl2: Fix expected type for multiplying vector with non-square matrix.Carl Worth2010-07-221-4/+22
| | | | | | | | | | | | | | | | | Previously, the compiler expected the result of the multiplication to be of the same type as the vector. This is correct for square matrices, but wrong for all others. We fix this by instead expecting a vector with the same number of rows as the matrix (for the case of M*v with a column vector) or the same number of columns as the matrix (for v*M with a row vector). This fix causes the following four glean tests to now pass: glsl1-mat4x2 * vec4 glsl1-vec2 * mat4x2 multiply glsl1-vec3 * mat4x3 multiply glsl1-vec4 * mat3x4 multiply
* glsl2: Fix the type of (1.0 - arg2) for mix(gen, gen, float).Eric Anholt2010-07-222-6/+6
| | | | | | | Previously, we'd constant-fold up a value of vec4(1.0 - arg2, 0, 0, 0). Fixes: glsl1-mix(vec4) function
* glsl2: When inlining, don't clone and assign sampler arguments.Eric Anholt2010-07-221-8/+18
| | | | | Instead, just use the incoming sampler param. Fixes many texture-using piglit tests since the linker rework.
* glsl2: When a "continue" happens in a "for" loop, run the loop expression.Eric Anholt2010-07-222-0/+15
| | | | | | | Fixes: glsl1-for-loop with continue Bug #29097
* ir_to_mesa: Pretty up the printing of MESA_GLSL=dumpEric Anholt2010-07-221-3/+13
|
* mesa: Only complain about an infinite loop in a swrast program once.Eric Anholt2010-07-221-1/+5
| | | | | Chances are, if one fragment looped badly, others will too, and debugging output gets overwhelmed by the looping complaints.
* ir_to_mesa: Add support for MESA_GLSL=dump environment var.Eric Anholt2010-07-221-4/+14
|
* glsl2: Use talloc on InfoLog handling in ValidateProgramEric Anholt2010-07-211-2/+2
| | | | Fixes a segfault in Regnum Online.
* glsl2: Update TODO.Kenneth Graunke2010-07-211-23/+0
|
* ir_constant_expression: Add support for array == and !=.Kenneth Graunke2010-07-212-4/+24
| | | | | Piglit parser tests const-array-03.frag and const-array-04.frag now generate the correct code.
* ir_constant_expression: Add support for constant arrays.Kenneth Graunke2010-07-211-1/+2
| | | | Fixes piglit test const-array-02.frag.
* ir_reader: Add support for reading constant arrays.Kenneth Graunke2010-07-211-2/+27
|
* ir_print_visitor: Print out constant arrays.Kenneth Graunke2010-07-211-10/+14
|
* ir_print_visitor: Remove commas between ir_constant's components.Kenneth Graunke2010-07-211-1/+1
| | | | The IR reader does not expect commas.
* glsl2: Extend ir_constant to store constant arrays, and generate them.Kenneth Graunke2010-07-214-5/+40
| | | | | | | | | 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.
* glsl2: Emit array constructors inline.Kenneth Graunke2010-07-211-11/+53
|
* ast_to_hir: Fix bug in constant initializers.Kenneth Graunke2010-07-211-0/+10
| | | | | | | | | Implicit conversions were not being performed, nor was there any type checking - it was possible to have, say, var->type == float and var->constant_value->type == int. Later use of the constant expression would trigger an assertion. Fixes piglit test const-implicit-conversion.frag.
* ir_constant_expression: Add support for ir_unop_u2f.Kenneth Graunke2010-07-211-6/+8
| | | | Also make ir_unop_i2f only operate on signed integers.
* ir_constant_expression: Remove open coded equality comparisons.Kenneth Graunke2010-07-211-38/+2
| | | | The ir_constant::has_value method already does this.
* glsl2: Add some comments.Kenneth Graunke2010-07-211-1/+4
|
* glsl2: Replace insert_before/remove pairs with exec_node::replace_with.Kenneth Graunke2010-07-216-14/+7
|
* linker: Link built-in functions instead of including them in every shaderIan Romanick2010-07-219-65/+261
| | | | | | | | This is an invasive set of changes. Each user shader tracks a set of other shaders that contain built-in functions. During compilation, function prototypes are imported from these shaders. During linking, the shaders are linked with these built-in-function shaders just like with any other shader.
* glsl2: Add function to import function prototypes from one IR tree to anotherIan Romanick2010-07-213-0/+144
|
* ir_to_mesa: Add missing initializion of lod_info variable.Carl Worth2010-07-211-1/+1
| | | | To quiet a compiler warning.
* glsl: Fix missing initialization of yylloc.sourceCarl Worth2010-07-212-0/+38
| | | | | | | | | | | | In both the preprocessor and in the compiler proper, we use a custom yyltype struct to allow tracking the source-string number in addition to line and column. However, we were previously relying on bison's default initialization of the yyltype struct which of course is not aware of the source field and leaves it uninitialized. We fix this by defining our own YYLLOC_DEFAULT macro expanding on the default version (as appears in the bison manual) and adding initialization of yylloc.source.
* glsl: Correctly handle unary plus operator.Carl Worth2010-07-211-3/+3
| | | | | | | | | Previously, any occurence of the unary plus operator would trigger a bogus type mismatch error. Fix this by making the ast_plus case look more like the ast_neg case as far as type-checking is concerned. With this change the shaders/CorrectPreprocess8.frag test in piglit now passes.
* glsl2: glsl_type has its own talloc context, don't pass one inIan Romanick2010-07-206-25/+18
|
* linker: Do post-link lowering and optimizationIan Romanick2010-07-201-0/+38
| | | | The lowering code should probably be moved elsewhere.
* glsl2: Implement utility routine to talloc reparent an IR treeIan Romanick2010-07-204-18/+20
|
* glsl2: Add a constructor for _mesa_glsl_parse_stateIan Romanick2010-07-204-32/+66
| | | | Coming changes to the handling of built-in functions necessitate this.
* glsl2: Add and use new variable mode ir_var_temporaryIan Romanick2010-07-2018-47/+109
| | | | | | | | | | | | | | | | | 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'.
* ir_to_mesa: Validate the linked shaders as well.Eric Anholt2010-07-201-0/+2
| | | | This caught the failure in cloning of ir_dereference_record.
* glsl2: Check that nodes in a valid tree aren't error-type.Eric Anholt2010-07-201-1/+2
| | | | | We're good at propagating error types around, but finding when the first one was triggered can be painful if we aren't paying attention.