summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* glcpp: Regnerate glcpp-parse.c and glcpp-parse.hCarl Worth2010-08-102-215/+224
| | | | After making a minor change to the .y file.
* glcpp: Initialize location structure at beginning of parse.Carl Worth2010-08-101-0/+8
| | | | | | | | | | Since we have a custom structure for YYLTYPE locations, we need to use an %initial-action directive to avoid triggering use of uninitialized memory when, for example, printing error messages. We apparently don't yet have a test case that allowed valgrind to find this bug for us, but valgrind found a similar problem in the other parser, so we fix this one as well.
* glsl2: Regenerate glsl_parser.cpp and glsl_parser.hCarl Worth2010-08-102-496/+505
| | | | After making a minor change to the .y file.
* glsl2: Initialize location structure at beginning of parse.Carl Worth2010-08-101-1/+9
| | | | | | | | Since we have a custom structure for YYLTYPE locations, we need to use an %initial-action directive to avoid triggering use of uninitialized memory when, for example, printing error messages. Thanks to valgrind for noticing this bug.
* glsl2: Make ir_algebraic reassociate add/mul operands for constant folding.Eric Anholt2010-08-091-1/+107
| | | | | | | | It's rather easy to produce two constant multiplies separated by other multiplies while writing a BRDF shader, and non-obvious enough in the resulting codegen that I didn't catch it in my demo code until just recently. Cuts 3 965 instructions from my demo (<1%), and 20 from glsl-fs-raytrace (1.3%).
* glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1))Eric Anholt2010-08-095-0/+80
| | | | | | All the current HW backends transform subtract to adding the negation, so I haven't bothered peepholing it back out in Mesa IR. This allows some subtract of subtract to get removed in ir_algebraic.
* glsl2: Add constant propagation.Eric Anholt2010-08-096-0/+486
| | | | | | | | Whereas constant folding evaluates constant expressions at rvalue nodes, constant propagation tracks constant components of vectors across execution to replace (possibly swizzled) variable dereferences with constant values, triggering possible constant folding or reduced variable liveness.
* i965: More s/stderr/stdout/ for program debug.Eric Anholt2010-08-093-3/+3
|
* glsl2: Teach copy propagation about "if" and "loop" instructions.Eric Anholt2010-08-091-90/+158
| | | | | | | | | This lets us track copies across basic block boundaries. The loop doesn't get a filled out list of available copies into it yet, though. glsl-fs-raytrace drops from 585 to 535 Mesa IR instructions out of the compiler, and it appears that Yo Frankie's largest shaders decrease in Mesa IR count by about 10% as well.
* glsl2: Refresh autogenerated file builtin_function.cpp.Kenneth Graunke2010-08-091-2/+2
|
* texture_builtins.py: Fix cut and paste errors in function names.Kenneth Graunke2010-08-093-4/+4
| | | | Some signatures were being generated with the wrong function name.
* glsl2: Use gl_DepthRange's proper name.Kenneth Graunke2010-08-091-1/+1
| | | | | It was being incorrectly added as gl_DepthRangeParameters, which is the type name, not the variable name.
* ir_algebraic: Support other comparisons in ir_unop_logic_notIan Romanick2010-08-091-0/+4
|
* ir_algebraic: Convert ir_unop_logic_not handler to use a switch statementIan Romanick2010-08-091-9/+19
| | | | | | Currently only ir_binop_equal and ir_binop_nequal are supported, but soon all of the relational operators will be added. Making this change now will simplify those commits.
* glsl2: do not use __retval name; two underscores is reserved word according ↵Aras Pranckevicius2010-08-092-5/+5
| | | | to GLSL spec (and Win7 ATI drivers do complain about that)
* glsl: fix missing return in ir_structure_splittingAras Pranckevicius2010-08-091-0/+1
|
* glsl2: Handle plain variable copies in struct splitting.Eric Anholt2010-08-081-3/+51
| | | | | glsl-fs-raytrace goes from 620 Mesa IR instructions out of the compiler to 585.
* glsl2: Add the 1.30 reserved keywords.Kenneth Graunke2010-08-075-1710/+2162
|
* ir_function_inlining: Fix missing iter.next() in inlining sampler params.Aras Pranckevicius2010-08-061-0/+2
| | | | Fixes glsl-fs-function-samplers.
* copy_propagation: do propagation into non-out call paramsAras Pranckevicius2010-08-061-5/+11
|
* glsl2: Move gl_program->InputsRead/OutputsWritten setting to an ir pass.Eric Anholt2010-08-064-67/+175
| | | | | | | This lets us handle arrays much better than trying to work backwards from assembly. Fixes fbo-drawbuffers-maxtargets on swrast (i965 needs loop unrolling)
* ir_to_mesa: Add support for sampler arrays.Eric Anholt2010-08-063-13/+43
| | | | | | | | | 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
* glsl2: Fix inlining with sampler array or struct dereferences as arguments.Eric Anholt2010-08-061-5/+138
| | | | | | | 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.
* glsl2: Don't assert in a couple of places when encountering sampler arrays.Eric Anholt2010-08-062-4/+11
| | | | Fixes glean shaderAPI.
* ir_to_mesa: Give the expected size for _mesa_add_attribute().Eric Anholt2010-08-061-1/+2
| | | | Fixes a failure in glean shaderAPI.
* ir_to_mesa: Handle texture-array samplersIan Romanick2010-08-051-2/+4
| | | | Fixes piglit test array_texture.
* glsl2: Enable all supported extensions in stand-alone compilerIan Romanick2010-08-051-0/+5
|
* glsl_type: Don't have two versions of a type with the same nameIan Romanick2010-08-052-9/+4
| | | | | | | | | | | | | | 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)
* glsl2: Log a better error message when a matching function cannot be foundIan Romanick2010-08-051-6/+51
|
* glsl2: Add a pass to convert exp and log to exp2 and log2.Eric Anholt2010-08-057-7/+96
| | | | | | | | | 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
* glsl2: Insert global declarations at the top of the instruction stream.Eric Anholt2010-08-051-1/+8
| | | | | | | | Fixes use-before-decl in glslparsertest shaders. Fixes: CorrectFull.frag CorrectModule.frag
* ir_structure_splitting: Massive fixing to this.Eric Anholt2010-08-051-9/+34
| | | | | | 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.
* glsl2: Make the HV actually call ir_texture's visit_leave.Eric Anholt2010-08-051-1/+1
|
* ir_structure_splitting: New pass to chop structures into their components.Eric Anholt2010-08-054-0/+381
| | | | | | | 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.
* glsl2: Fix the dereferences_variable check in ir_tree_grafting.Eric Anholt2010-08-051-2/+3
| | | | | | | | | | | 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
* glsl2: Don't tree-grafting out assignment to an out variable.Eric Anholt2010-08-051-0/+4
| | | | | Fixes: glsl-deadcode-varying.
* glsl2: Don't dead-code eliminate a call where the return value is unused.Eric Anholt2010-08-054-6/+20
| | | | | | | | This showed up since the disabling of inlining at compile time, which I apparently didn't regenerate piglit summary for. Fixes: glsl-deadcode-call.
* glsl2: Add some easy-to-enable debug printfs to ir_dead_code.cpp.Eric Anholt2010-08-051-0/+19
|
* ir_to_mesa: Don't do function inlining until linking.Eric Anholt2010-08-051-1/+0
| | | | | | | | | | | | 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).
* glsl2: Add a pass for removing unused functions.Eric Anholt2010-08-056-1/+160
| | | | | | | | | 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%).
* glsl2: Catch pointless copies in copy propagation.Eric Anholt2010-08-051-5/+17
| | | | | | | | | 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
* glsl2: Don't try to dump GLSL IR for a shader that didn't compile.Eric Anholt2010-08-051-3/+5
|
* ir_to_mesa: Remove debug force-enablement of EmitNoIfs.Eric Anholt2010-08-051-1/+1
|
* glcpp: Ignore #if and #elif expressions when skipping.Kenneth Graunke2010-08-042-96/+124
| | | | | Fixes glcpp test cases 073 and 074, as well as piglit test xonotic-vs-generic-diffuse.vert.
* glcpp/tests: Add a corollary to testcase 073 for testing #elif.Kenneth Graunke2010-08-041-0/+3
|
* glcpp/tests: Fix 073-if-in-ifdef.c to use #ifdef, not #if.Kenneth Graunke2010-08-041-1/+1
| | | | The original intention was to use #ifdef.
* glcpp: Refactor HASH_IF and HASH_ELIF expansion to reuse code.Kenneth Graunke2010-08-042-144/+142
|
* glsl2: Remove the shader_in/shader_out tracking separate from var->mode.Eric Anholt2010-08-047-57/+17
| | | | | | | | | | | | | | | 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.
* glsl2: Remove a dead cut and paste member from ir_variable_refcount_visitor.Eric Anholt2010-08-041-2/+0
|
* i965: Settle on printing our program debug to stdout.Eric Anholt2010-08-045-26/+34
| | | | | | 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.