Aras Pranckevicius [Mon, 9 Aug 2010 08:17:32 +0000 (11:17 +0300)]
glsl2: do not use __retval name; two underscores is reserved word according to GLSL spec (and Win7 ATI drivers do complain about that)
Aras Pranckevicius [Mon, 9 Aug 2010 08:50:24 +0000 (11:50 +0300)]
glsl: fix missing return in ir_structure_splitting
Eric Anholt [Mon, 9 Aug 2010 06:29:54 +0000 (23:29 -0700)]
glsl2: Handle plain variable copies in struct splitting.
glsl-fs-raytrace goes from 620 Mesa IR instructions out of the
compiler to 585.
Kenneth Graunke [Sat, 7 Aug 2010 07:50:08 +0000 (00:50 -0700)]
glsl2: Add the 1.30 reserved keywords.
Aras Pranckevicius [Fri, 6 Aug 2010 10:31:56 +0000 (12:31 +0200)]
ir_function_inlining: Fix missing iter.next() in inlining sampler params.
Fixes glsl-fs-function-samplers.
Aras Pranckevicius [Fri, 6 Aug 2010 14:09:02 +0000 (16:09 +0200)]
copy_propagation: do propagation into non-out call params
Eric Anholt [Fri, 6 Aug 2010 20:07:25 +0000 (13:07 -0700)]
glsl2: Move gl_program->InputsRead/OutputsWritten setting to an ir pass.
This lets us handle arrays much better than trying to work backwards
from assembly.
Fixes fbo-drawbuffers-maxtargets on swrast (i965 needs loop unrolling)
Eric Anholt [Fri, 6 Aug 2010 00:00:12 +0000 (17:00 -0700)]
ir_to_mesa: Add support for sampler arrays.
Support for samplers in general is still incomplete -- anything in a
uniform struct will still be broken. But that doesn't appear to be
any different from master.
Fixes:
glsl-fs-uniform-sampler-array.shader_test
Eric Anholt [Fri, 6 Aug 2010 07:21:12 +0000 (00:21 -0700)]
glsl2: Fix inlining with sampler array or struct dereferences as arguments.
Previously, we'd replace an argument of mysampler[2] with a plain
reference to mysampler by using the cloning hash table. Instead, use
a visitor to clone whatever complicated sampler dereference into the
sampler parameter derefs in the inlined function body.
Eric Anholt [Thu, 5 Aug 2010 23:00:46 +0000 (16:00 -0700)]
glsl2: Don't assert in a couple of places when encountering sampler arrays.
Fixes glean shaderAPI.
Eric Anholt [Thu, 5 Aug 2010 22:54:56 +0000 (15:54 -0700)]
ir_to_mesa: Give the expected size for _mesa_add_attribute().
Fixes a failure in glean shaderAPI.
Ian Romanick [Fri, 6 Aug 2010 00:57:48 +0000 (17:57 -0700)]
ir_to_mesa: Handle texture-array samplers
Fixes piglit test array_texture.
Ian Romanick [Fri, 6 Aug 2010 00:50:13 +0000 (17:50 -0700)]
glsl2: Enable all supported extensions in stand-alone compiler
Ian Romanick [Fri, 6 Aug 2010 00:29:15 +0000 (17:29 -0700)]
glsl_type: Don't have two versions of a type with the same name
Previously some sampler types were duplicated in GLSL 1.30 and
GL_EXT_texture_array. This resulted in not being able to find the
built-in sampler functions when the extension was used. When the
built-in functions were compiled, they bound to the 1.30 version.
This caused a type mismatch when trying to find the function. It also
resulted in a confusing error message:
0:0(0): error: no matching function for call to `texture2DArray(sampler2DArray, vec3)'
0:0(0): error: candidates are: vec4 texture2DArray(sampler2DArray, vec3)
0:0(0): error: vec4 texture2DArray(sampler2DArray, vec3, float)
Ian Romanick [Fri, 6 Aug 2010 00:21:39 +0000 (17:21 -0700)]
glsl2: Log a better error message when a matching function cannot be found
Eric Anholt [Thu, 5 Aug 2010 22:22:05 +0000 (15:22 -0700)]
glsl2: Add a pass to convert exp and log to exp2 and log2.
Fixes ir_to_mesa handling of unop_log, which used the weird ARB_vp LOG
opcode that doesn't do what we want. This also lets the multiplication
coefficients in there get constant-folded, possibly.
Fixes:
glsl-fs-log
Eric Anholt [Thu, 5 Aug 2010 21:41:09 +0000 (14:41 -0700)]
glsl2: Insert global declarations at the top of the instruction stream.
Fixes use-before-decl in glslparsertest shaders.
Fixes:
CorrectFull.frag
CorrectModule.frag
Eric Anholt [Thu, 5 Aug 2010 20:25:39 +0000 (13:25 -0700)]
ir_structure_splitting: Massive fixing to this.
I'd missed putting in the actual "find structures to split" part, so
most of the code didn't do anything. I was running on too large of an
app and assuming the lack of progress was elsewhere.
Eric Anholt [Thu, 5 Aug 2010 20:33:38 +0000 (13:33 -0700)]
glsl2: Make the HV actually call ir_texture's visit_leave.
Eric Anholt [Thu, 5 Aug 2010 18:01:09 +0000 (11:01 -0700)]
ir_structure_splitting: New pass to chop structures into their components.
This doesn't do anything if your structure goes through an uninlined
function call or if whole-structure assignment occurs. As such, the
impact is limited, at least until we do some global copy propagation
to reduce whole-structure assignment.
Eric Anholt [Thu, 5 Aug 2010 19:52:29 +0000 (12:52 -0700)]
glsl2: Fix the dereferences_variable check in ir_tree_grafting.
The HV doesn't descend into ir_variable, which is generally a good
thing (allowing one to distinguish between variable declarations and
refs), but here we never saw tree grafting opportunities killed
because we were looking for the ir_variable child of a dereference to
get visited.
Fixes:
glsl1-function call with inout params
Eric Anholt [Thu, 5 Aug 2010 19:24:36 +0000 (12:24 -0700)]
glsl2: Don't tree-grafting out assignment to an out variable.
Fixes:
glsl-deadcode-varying.
Eric Anholt [Thu, 5 Aug 2010 19:10:31 +0000 (12:10 -0700)]
glsl2: Don't dead-code eliminate a call where the return value is unused.
This showed up since the disabling of inlining at compile time, which
I apparently didn't regenerate piglit summary for.
Fixes:
glsl-deadcode-call.
Eric Anholt [Thu, 5 Aug 2010 19:07:23 +0000 (12:07 -0700)]
glsl2: Add some easy-to-enable debug printfs to ir_dead_code.cpp.
Eric Anholt [Thu, 5 Aug 2010 17:13:10 +0000 (10:13 -0700)]
ir_to_mesa: Don't do function inlining until linking.
Optimizations at compile time should generally be done with the goal
of reducing instruction count so that other work, particularly
linking, is less time-consuming if the shader is used multiple times.
However, function inlining increases instruction count for the inlined
function bodies without removing the original function body, since we
don't know if it will be used at link time or not.
Reduces the runtime of linking and executing a Yo Frankie fragment
shader from 0.9 seconds to 0.5 seconds (-45.9%, +/- 2.2%, n=5).
Eric Anholt [Thu, 5 Aug 2010 17:09:12 +0000 (10:09 -0700)]
glsl2: Add a pass for removing unused functions.
For a shader involving many small functions, this avoids running
optimization across all of them after they've been inlined
post-linking.
Reduces the runtime of linking and running a fragment shader from Yo
Frankie from 1.6 seconds to 0.9 seconds (-44.9%, +/- 3.3%).
Eric Anholt [Thu, 5 Aug 2010 06:23:15 +0000 (23:23 -0700)]
glsl2: Catch pointless copies in copy propagation.
We wouldn't want to go rewriting dereferences to variables to point at
the same variable it did before. While I didn't find a way to trigger
that, a shader in Yo Frankie managed to produce a self-assignment by
passing a constant to a function doing self assignment like this.
Cleans up the IR for glsl-deadcode-self-assign.shader_test
Eric Anholt [Thu, 5 Aug 2010 05:57:08 +0000 (22:57 -0700)]
glsl2: Don't try to dump GLSL IR for a shader that didn't compile.
Eric Anholt [Thu, 5 Aug 2010 05:35:32 +0000 (22:35 -0700)]
ir_to_mesa: Remove debug force-enablement of EmitNoIfs.
Kenneth Graunke [Wed, 4 Aug 2010 23:24:39 +0000 (16:24 -0700)]
glcpp: Ignore #if and #elif expressions when skipping.
Fixes glcpp test cases 073 and 074, as well as piglit test
xonotic-vs-generic-diffuse.vert.
Kenneth Graunke [Wed, 4 Aug 2010 23:22:31 +0000 (16:22 -0700)]
glcpp/tests: Add a corollary to testcase 073 for testing #elif.
Kenneth Graunke [Wed, 4 Aug 2010 23:21:33 +0000 (16:21 -0700)]
glcpp/tests: Fix 073-if-in-ifdef.c to use #ifdef, not #if.
The original intention was to use #ifdef.
Kenneth Graunke [Wed, 4 Aug 2010 23:10:03 +0000 (16:10 -0700)]
glcpp: Refactor HASH_IF and HASH_ELIF expansion to reuse code.
Eric Anholt [Thu, 5 Aug 2010 03:33:57 +0000 (20:33 -0700)]
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.
Eric Anholt [Thu, 5 Aug 2010 03:03:15 +0000 (20:03 -0700)]
glsl2: Remove a dead cut and paste member from ir_variable_refcount_visitor.
Eric Anholt [Thu, 5 Aug 2010 02:55:52 +0000 (19:55 -0700)]
i965: Settle on printing our program debug to stdout.
Mixing stderr (_mesa_print_program, _mesa_print_instruction,
_mesa_print_alu) with stdout means that when writing both to a file,
there isn't a consistent ordering between the two.
Eric Anholt [Thu, 5 Aug 2010 02:43:41 +0000 (19:43 -0700)]
ir_to_mesa: Print shader source and compiled IR under MESA_GLSL=dump.
While the Mesa IR dumping includes some corresponding GLSL IR for
correlating Mesa IR to GLSL IR, it doesn't completely express it.
This printing includes things like variable declarations and control
flow structure that is hard to read otherwise.
Eric Anholt [Thu, 5 Aug 2010 00:12:14 +0000 (17:12 -0700)]
glsl2: Use linked ir_constant_variable after linking, instead of unlinked.
Eric Anholt [Wed, 4 Aug 2010 23:32:12 +0000 (16:32 -0700)]
glsl2: Return progress from ir_vec_index_to_swizzle.
Ian Romanick [Wed, 4 Aug 2010 23:27:55 +0000 (16:27 -0700)]
glsl2: Generate masked assignments in some expanded matrix operations
Ian Romanick [Tue, 3 Aug 2010 23:05:54 +0000 (16:05 -0700)]
glsl2: Generate masked assignments in vector and matrix constructors
Previously the in-line matrix and vector constructors would generate
swizzles in the LHS. The code is actually more clear if it just
generates the masked assignments instead of relying on the
ir_assignment constructor to convert the swizzles to write masks.
Ian Romanick [Wed, 4 Aug 2010 23:27:17 +0000 (16:27 -0700)]
glsl2: Additional validation of write masks
Ian Romanick [Tue, 3 Aug 2010 01:48:25 +0000 (18:48 -0700)]
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.
Ian Romanick [Tue, 3 Aug 2010 22:02:35 +0000 (15:02 -0700)]
glsl2: Don't try to construct an ir_assignment with an invalid LHS
Eric Anholt [Wed, 4 Aug 2010 23:18:18 +0000 (16:18 -0700)]
glsl2: Constant fold the children of many more ir_instruction types.
Eric Anholt [Wed, 4 Aug 2010 23:07:41 +0000 (16:07 -0700)]
glsl2: Return a real progress value from constant folding.
Eric Anholt [Wed, 4 Aug 2010 23:06:00 +0000 (16:06 -0700)]
glsl2: Refactor constant folding of rvalues to a function.
Kenneth Graunke [Wed, 4 Aug 2010 03:25:13 +0000 (20:25 -0700)]
glcpp: Refresh autogenerated lexer and parser.
Kenneth Graunke [Wed, 4 Aug 2010 03:21:52 +0000 (20:21 -0700)]
glcpp: Remove xtalloc wrappers in favor of plain talloc.
Calling exit() on a memory failure probably made sense for the
standalone preprocessor, but doesn't seem too appealing as part of
the GL library. Also, we don't use it in the main compiler.
Kenneth Graunke [Wed, 4 Aug 2010 03:05:53 +0000 (20:05 -0700)]
glsl2: Remove uses of deprecated TALLOC_CTX type.
Aras Pranckevicius [Wed, 4 Aug 2010 15:11:32 +0000 (17:11 +0200)]
glsl2: add gl_LightModel built-in uniform.
Eric Anholt [Wed, 4 Aug 2010 21:26:15 +0000 (14:26 -0700)]
glsl2: Don't try to assign locations for samplers during linking.
Mesa will do the mapping at _mesa_add_sampler() time. Fixes assertion
failures in debug builds, which might have caught real problems with
multiple samplers linked in a row.
Eric Anholt [Wed, 4 Aug 2010 21:21:01 +0000 (14:21 -0700)]
ir_to_mesa: Clean up the mapping of samplers to Mesa's sampler uniforms.
Instead of using a linker-assigned location (since samplers don't
actually take up uniform space, being a link-time choice), use the
sampler's varaible pointer as a hash key.
Eric Anholt [Wed, 4 Aug 2010 21:13:08 +0000 (14:13 -0700)]
mesa: Don't null deref looking for Mesa IR code at compile time.
The new compiler doesn't generate Mesa IR at compile time, and that
compile time code previously wouldn't have reflected the link time
code that actually got used. But do dump the info log of the compile
regardless.
Eric Anholt [Wed, 4 Aug 2010 19:57:58 +0000 (12:57 -0700)]
glsl2: Skip talloc_parent in constant_expression of non-constant arrays.
Eric Anholt [Wed, 4 Aug 2010 19:34:56 +0000 (12:34 -0700)]
glsl2: Make the clone() method take a talloc context.
In most cases, we needed to be reparenting the cloned IR to a
different context (for example, to the linked shader instead of the
unlinked shader), or optimization before the reparent would cause
memory usage of the original object to grow and grow.
Aras Pranckevicius [Wed, 4 Aug 2010 14:31:04 +0000 (16:31 +0200)]
glsl2: Set ir_discard::ir_type when cloning it
Fixes unset ir_type after inlining.
Eric Anholt [Tue, 3 Aug 2010 18:43:25 +0000 (11:43 -0700)]
glsl2: Fix ir_validate validating null variable names.
An unnamed variable in a prototype will have a NULL ->name, so don't
worry about storage then.
Fixes:
CorrectFunction1.vert
CorrectParse1.frag
Eric Anholt [Tue, 3 Aug 2010 18:40:26 +0000 (11:40 -0700)]
glsl2: No need to strdup the name passed in to ir_variable constructor.
ir_variable always strdups the incoming name so that it matches the
lifetime of the ir_variable.
Eric Anholt [Tue, 3 Aug 2010 00:49:01 +0000 (17:49 -0700)]
glsl2: Fix typo in clamp() constant builtin using uint instead of int.
I take back the bad things I've said about the signed/unsigned
comparison warning now.
Eric Anholt [Tue, 3 Aug 2010 00:05:48 +0000 (17:05 -0700)]
ir_to_mesa: Add support for 1.20 uniform initializers.
Fixes:
glsl-uniform-initializer-1
glsl-uniform-initializer-2
glsl-uniform-initializer-3
glsl-uniform-initializer-4
glsl1-GLSL 1.20 uniform array constructor
Eric Anholt [Mon, 2 Aug 2010 22:31:28 +0000 (15:31 -0700)]
glsl2: Don't consider uniform initializers as constant expressions.
We were happily optimizing away the body of
glsl-uniform-initializer-* to never use the uniforms.
Eric Anholt [Mon, 2 Aug 2010 23:59:20 +0000 (16:59 -0700)]
Initialize a couple of HasIndex2 fields on Mesa IR src regs.
Eric Anholt [Mon, 2 Aug 2010 21:32:52 +0000 (14:32 -0700)]
ir_to_mesa: Support for struct uniforms.
Fixes glsl-uniform-struct.
Eric Anholt [Mon, 2 Aug 2010 21:47:10 +0000 (14:47 -0700)]
ir_to_mesa: Add a constructor for ir_to_mesa_src_reg.
This helps makes sure we don't miss any new fields, and makes totally
uninitialized src_regs be PROGRAM_UNDEFINED.
Carl Worth [Tue, 3 Aug 2010 00:27:56 +0000 (17:27 -0700)]
glsl2: Use talloc_zero_size instead of talloc_size to allocate ast_node objects.
This is a zero-ing function, (like calloc), to avoid bugs due to
accessing uninitialized values. Thanks to valgrind for noticing the
use of uninitialized values.
Ian Romanick [Mon, 2 Aug 2010 20:41:04 +0000 (13:41 -0700)]
glsl_type: Use string key for array type hash
Ian Romanick [Mon, 2 Aug 2010 19:49:20 +0000 (12:49 -0700)]
Keep a local copy of the symbol name in the symbol table
The symbol_header structure that tracks symbols with a particular name
may have a different (longer) life time than the symbols it tracks.
Not keeping a local copy of the name can lead to use-after-free
errors. For example, the following sequence would trigger such an
error:
char *copy = strdup(name);
_mesa_symbol_table_push_scope(st);
_mesa_symbol_table_add_symbol(st, 0, name, NULL);
_mesa_symbol_table_pop_scope(st);
free(name);
_mesa_symbol_table_find_symbol(st, 0, copy);
With this change, the symbol table keeps a local copy of the name that
has the same life time as the symbol_header for that name. This
resolves some use-after-free errors with built-in functions in the
GLSL compiler.
Ian Romanick [Mon, 2 Aug 2010 18:46:22 +0000 (11:46 -0700)]
glsl2: Clean-up two 'unused variable' warnings
Ian Romanick [Mon, 2 Aug 2010 18:35:14 +0000 (11:35 -0700)]
glsl2: Make glsl_types::ctx private again
Eric Anholt [Mon, 2 Aug 2010 19:28:38 +0000 (12:28 -0700)]
glsl2: Fix expression type in builtin tan().
Fixes glsl-fs-tan-1.
Eric Anholt [Mon, 2 Aug 2010 19:08:52 +0000 (12:08 -0700)]
glsl2: Add validation that talloc ownership of ir_* names is right.
Eric Anholt [Mon, 2 Aug 2010 19:06:34 +0000 (12:06 -0700)]
glsl2: Fix validation for ir_unop_not.
We use vector ir_unop_not to implement builtin not(), and that seems fine.
Eric Anholt [Mon, 2 Aug 2010 18:26:43 +0000 (11:26 -0700)]
glsl2: Add support for floating constants like "1f".
Fixes glsl-floating-constant-120.
Eric Anholt [Mon, 2 Aug 2010 18:20:32 +0000 (11:20 -0700)]
glsl2: Initialize the ARB_fcc fields of ir_variable.
Fixes intermittent failure in glsl-arb-fragment-coord-conventions.
Eric Anholt [Mon, 2 Aug 2010 18:04:54 +0000 (11:04 -0700)]
glsl2: Also initialize the identifier field of parameter_declarator.
The non-named parameter grammar understandably doesn't set the
identifier field. Fixes intermittent failures about void main(void)
{} having a named void parameter.
Eric Anholt [Mon, 2 Aug 2010 17:54:22 +0000 (10:54 -0700)]
glsl2: Fix spelling of "precision" in error output.
Eric Anholt [Mon, 2 Aug 2010 17:49:29 +0000 (10:49 -0700)]
glsl2: Don't add mesa/program/ as an include dir. Let includes say program/.
Aras Pranckevicius [Thu, 29 Jul 2010 09:40:49 +0000 (12:40 +0300)]
glsl2: Give the path within src/mesa/ for headers instead of relying on -I.
Aras Pranckevicius [Mon, 2 Aug 2010 07:22:26 +0000 (10:22 +0300)]
glsl2: initialize is_array and array_size of ast_parameter_declarator
The non-array path of glsl_parser.ypp wasn't setting is_array to false.
Eric Anholt [Mon, 2 Aug 2010 01:44:21 +0000 (18:44 -0700)]
glsl2: Make non-square matrix keywords not keywords pre-120.
Fixes glsl-mat-110.
Eric Anholt [Sun, 1 Aug 2010 18:40:41 +0000 (11:40 -0700)]
ir_to_mesa: Add support for MESA_GLSL=log.
This is the option that dumps shader source to files in the current
directory.
Eric Anholt [Sun, 1 Aug 2010 18:40:07 +0000 (11:40 -0700)]
glcpp: Add a testcase for the failure in compiling xonotic's shader.
gcc and mesa master agree that this is OK.
Eric Anholt [Sat, 31 Jul 2010 22:47:35 +0000 (15:47 -0700)]
glsl2: Do algebraic optimizations after linking as well.
Linking brings in inlining of builtins, so we weren't catching the
(rcp(/sqrt(x)) -> rsq(x)) without it.
Eric Anholt [Sat, 31 Jul 2010 00:04:49 +0000 (17:04 -0700)]
glsl2: Add new tree grafting optimization pass.
Eric Anholt [Fri, 30 Jul 2010 23:05:27 +0000 (16:05 -0700)]
glsl2: Factor out the variable refcounting part of ir_dead_code.cpp.
Aras Pranckevicius [Thu, 29 Jul 2010 12:35:22 +0000 (15:35 +0300)]
glsl2: Fix stack smash when ternary selection is used.
Eric Anholt [Fri, 30 Jul 2010 17:20:34 +0000 (10:20 -0700)]
glsl2: Fix the implementation of atan(y, x).
So many problems here. One is that we can't do the quadrant handling
for all the channels at the same time, so we call the float(y, x)
version multiple times. I'd also left out the x == 0 handling. Also,
the quadrant handling was broken for y == 0, so there was a funny
discontinuity on the +x side if you plugged in obvious values to test.
I generated the atan(float y, float x) code from a short segment of
GLSL and pasted it in by hand. It would be nice to automate that
somehow.
Fixes:
glsl-fs-atan-1
glsl-fs-atan-2
Carl Worth [Thu, 29 Jul 2010 23:39:36 +0000 (16:39 -0700)]
ast: Initialize location data in constructor of all ast_node objects.
This prevents using uninitialized data in _msea_glsl_error in some
cases, (including at least 6 piglit tests). Thanks to valgrind for
pointing out the problem!
Eric Anholt [Fri, 30 Jul 2010 21:44:09 +0000 (14:44 -0700)]
ir_to_mesa: Add the function name as a comment to BGNSUB and ENDSUB.
Eric Anholt [Fri, 30 Jul 2010 18:24:23 +0000 (11:24 -0700)]
glsl2: Update the callee pointer of calls to newly-linked-in functions.
Otherwise, ir_function_inlining will see the body of the function from
the unlinked version of the shader, which won't have had the lowering
passes done on it or linking's variable remapping.
Kenneth Graunke [Fri, 30 Jul 2010 20:30:11 +0000 (13:30 -0700)]
glsl2: Initialize ir_function_signature::is_built_in.
Fixes a valgrind error.
Kenneth Graunke [Fri, 30 Jul 2010 20:24:50 +0000 (13:24 -0700)]
glcpp: Don't look for backslashes before the beginning of the string.
Fixes a valgrind error.
Eric Anholt [Thu, 29 Jul 2010 22:49:14 +0000 (15:49 -0700)]
glsl2: Do ir_if_return on the way out, not the way in.
The problem with doing it on the way in is that for a function with
multiple early returns, we'll move an outer block in, then restart the
pass, then move the two inside returns out, then never move outer
blocks in again because the remaining early returns are inside an else
block and they don't know that there's a return just after their
block. By going inside-out, we get the early returns stacked up so
that they all move out with a series of
move_returns_after_block().
Fixes (on i965):
glsl-fs-raytrace-bug27060
glsl-vs-raytrace-bug26691
Eric Anholt [Thu, 29 Jul 2010 20:29:17 +0000 (13:29 -0700)]
glsl2: Make sure functions end with a return before doing ir_if_return.
This catches a few remaining functions that weren't getting inlined,
generally operating on global or out variables and using an early
return to skip work when possible.
Fixes for i965:
glsl1-function with early return (3)
Eric Anholt [Thu, 29 Jul 2010 19:36:06 +0000 (12:36 -0700)]
glsl2: Make ir_if_return handle if () { return } else { not return }
This makes many remaining functions inlinable.
Fixes for i965:
glsl1-function with early return (1)
glsl1-function with early return (2)
Eric Anholt [Thu, 29 Jul 2010 19:15:04 +0000 (12:15 -0700)]
glsl2: Refactor a bit of ir_if_return for the next changes.
Eric Anholt [Thu, 29 Jul 2010 22:17:23 +0000 (15:17 -0700)]
ir_to_mesa: Don't emit a duplicate return at the end of a function.
It was harmless, but ugly.
Eric Anholt [Thu, 29 Jul 2010 22:04:45 +0000 (15:04 -0700)]
glsl2: Allow use of _mesa_print_ir without a parse state on hand.
Eric Anholt [Thu, 29 Jul 2010 21:54:01 +0000 (14:54 -0700)]
ir_constant_variable: Don't mark variable from outside our scope as constant.
Fixes (with software, except for alpha):
glsl1-function with early return(3)