summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* 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-061-4/+6
| | | | Fixes glean shaderAPI.
* 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-056-2/+94
| | | | | | | | | 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
|
* 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
* 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
|
* glsl2: Use linked ir_constant_variable after linking, instead of unlinked.Eric Anholt2010-08-041-1/+1
|
* glsl2: Return progress from ir_vec_index_to_swizzle.Eric Anholt2010-08-041-1/+1
|
* glsl2: Generate masked assignments in some expanded matrix operationsIan Romanick2010-08-041-5/+10
|
* glsl2: Generate masked assignments in vector and matrix constructorsIan Romanick2010-08-041-36/+46
| | | | | | | 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.
* glsl2: Additional validation of write masksIan Romanick2010-08-041-0/+32
|
* glsl2: Add ir_assignment::write_mask and associated methodsIan Romanick2010-08-049-10/+174
| | | | | | | | | | | | | | | | | | | | | | | 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.
* glsl2: Don't try to construct an ir_assignment with an invalid LHSIan Romanick2010-08-041-3/+2
|
* glsl2: Constant fold the children of many more ir_instruction types.Eric Anholt2010-08-041-7/+32
|
* glsl2: Return a real progress value from constant folding.Eric Anholt2010-08-041-3/+6
|
* glsl2: Refactor constant folding of rvalues to a function.Eric Anholt2010-08-041-26/+21
|
* glcpp: Refresh autogenerated lexer and parser.Kenneth Graunke2010-08-043-155/+148
|
* glcpp: Remove xtalloc wrappers in favor of plain talloc.Kenneth Graunke2010-08-046-153/+28
| | | | | | 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.
* glsl2: Remove uses of deprecated TALLOC_CTX type.Kenneth Graunke2010-08-043-25/+25
|
* glsl2: add gl_LightModel built-in uniform.Aras Pranckevicius2010-08-041-0/+1
|
* glsl2: Don't try to assign locations for samplers during linking.Eric Anholt2010-08-041-0/+3
| | | | | | 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.
* glsl2: Skip talloc_parent in constant_expression of non-constant arrays.Eric Anholt2010-08-041-1/+1
|
* glsl2: Make the clone() method take a talloc context.Eric Anholt2010-08-049-131/+130
| | | | | | | 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.
* glsl2: Set ir_discard::ir_type when cloning itAras Pranckevicius2010-08-041-0/+1
| | | | Fixes unset ir_type after inlining.
* glsl2: Fix ir_validate validating null variable names.Eric Anholt2010-08-031-1/+2
| | | | | | | | | An unnamed variable in a prototype will have a NULL ->name, so don't worry about storage then. Fixes: CorrectFunction1.vert CorrectParse1.frag
* glsl2: No need to strdup the name passed in to ir_variable constructor.Eric Anholt2010-08-031-13/+5
| | | | | ir_variable always strdups the incoming name so that it matches the lifetime of the ir_variable.
* glsl2: Fix typo in clamp() constant builtin using uint instead of int.Eric Anholt2010-08-021-1/+1
| | | | | I take back the bad things I've said about the signed/unsigned comparison warning now.
* glsl2: Don't consider uniform initializers as constant expressions.Eric Anholt2010-08-021-0/+6
| | | | | We were happily optimizing away the body of glsl-uniform-initializer-* to never use the uniforms.
* glsl2: Use talloc_zero_size instead of talloc_size to allocate ast_node objects.Carl Worth2010-08-021-1/+1
| | | | | | 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.
* glsl_type: Use string key for array type hashIan Romanick2010-08-022-40/+12
|
* glsl2: Clean-up two 'unused variable' warningsIan Romanick2010-08-022-0/+5
|
* glsl2: Make glsl_types::ctx private againIan Romanick2010-08-022-3/+5
|
* glsl2: Fix expression type in builtin tan().Eric Anholt2010-08-022-6/+6
| | | | Fixes glsl-fs-tan-1.
* glsl2: Add validation that talloc ownership of ir_* names is right.Eric Anholt2010-08-021-1/+3
|