summaryrefslogtreecommitdiff
path: root/src/glsl/linker.cpp
AgeCommit message (Collapse)Author
2010-12-09android: Fix build with bionic.Chia-I Wu
2010-12-07linker: Fix regressions caused by previous commitIan Romanick
That's what I get for not running piglit before pushing. Don't try to patch types of unsized arrays when linking fails. Don't try to patch types of unsized arrays that are shared between shader stages.
2010-12-07linker: Ensure that unsized arrays have a size after linkingIan Romanick
Fixes piglit test case glsl-vec-array (bugzilla #31908). NOTE: This bug does not affect 7.9, but I think this patch is a candiate for the 7.9 branch anyway.
2010-12-01glsl: Fix linker bug in cross_validate_globals()Chad Versace
Cause linking to fail if a global has mismatching invariant qualifiers. See https://bugs.freedesktop.org/show_bug.cgi?id=30261
2010-11-30glsl/linker: Free any IR discarded by optimization passes.Kenneth Graunke
Previously, IR for a linked shader was allocated directly out of the gl_shader object - meaning all of it lived as long as the shader. Now, IR is allocated out of a temporary context, and any -live- IR is reparented/stolen to (effectively) the gl_shader. Any remaining IR can be freed. NOTE: This is a candidate for the 7.9 branch.
2010-11-29glsl: Make the symbol table's add_variable just use the variable's name.Eric Anholt
2010-11-29glsl: Make the symbol table's add_function just use the function's name.Eric Anholt
2010-10-19linker: Improve handling of unread/unwritten shader inputs/outputsIan Romanick
Previously some shader input or outputs that hadn't received location assignments could slip through. This could happen when a shader contained user-defined varyings and was used with either fixed-function or assembly shaders. See the piglit tests glsl-[fv]s-user-varying-ff and sso-user-varying-0[12]. NOTE: this is a candidate for the 7.9 branch.
2010-10-15linker: Trivial indention fixIan Romanick
2010-10-14glsl: Slightly change the semantic of _LinkedShadersIan Romanick
Previously _LinkedShaders was a compact array of the linked shaders for each shader stage. Now it is arranged such that each slot, indexed by the MESA_SHADER_* defines, refers to a specific shader stage. As a result, some slots will be NULL. This makes things a little more complex in the linker, but it simplifies things in other places. As a side effect _NumLinkedShaders is removed. NOTE: This may be a candidate for the 7.9 branch. If there are other patches that get backported to 7.9 that use _LinkedShader, this patch should be cherry picked also.
2010-10-13linker: Reject shaders that have unresolved function callsIan Romanick
This really amounts to just using the return value from link_function_calls. All the work was being done, but the result was being ignored. Fixes piglit test link-unresolved-funciton. NOTE: this is a candidate for the 7.9 branch.
2010-10-13Drop GLcontext typedef and use struct gl_context insteadKristian Høgsberg
2010-10-08glsl: Add linker support for explicit attribute locationsIan Romanick
2010-10-08glsl: Fail linking if assign_attribute_locations failsIan Romanick
2010-09-28glsl: Also update implicit sizes of varyings at link time.Eric Anholt
Otherwise, we'll often end up with gl_TexCoord being 0 length, for example. With ir_to_mesa, things ended up working out anyway, as long as multiple implicitly-sized arrays weren't involved.
2010-09-21glsl2: fix typo in error msgBrian Paul
2010-09-08glsl: add several EmitNo* options, and MaxUnrollIterationsLuca Barbieri
This increases the chance that GLSL programs will actually work. Note that continues and returns are not yet lowered, so linking will just fail if not supported. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-07glsl: Move is_builtin flag back to ir_function_signature.Kenneth Graunke
This effectively reverts b6f15869b324ae64a00d0fe46fa3c8c62c1edb6c. In desktop GLSL, defining a function with the same name as a built-in hides that built-in function completely, so there would never be built-in and user function signatures in the same ir_function. However, in GLSL ES, overloading built-ins is allowed, and does not hide the built-in signatures - so we're back to needing this.
2010-09-07linker: Fix assertion and cross-version checks for version 100.Kenneth Graunke
Fixes an assert (min_version >= 110) which was no longer correct, and also prohibits linking ES2 shaders with non-ES2 shaders. I'm not positive this is correct, but the specification doesn't seem to say.
2010-09-07glsl2: check for _NumLinkedShaders being 0Török Edvin
Otherwise spring 0.82+.4.0 crashes when starting a game because prog->_LinkedShaders[0] is NULL. This also fixes piglit test cases glsl-link-empty-prog-0[12].
2010-08-30linker: Handle varying arrays, matrices, and arrays of matricesIan Romanick
Fixes piglit test case glsl-array-varying-01.
2010-08-29linker: Treat sized and unsized array types as the sameIan Romanick
If two shaders contain variables declared with array types that have the same base type but one is sized and the other is not, linking should succeed. I'm not super pleased with the way this is implemented, and I am more convinced than ever that we need more linker tests. We especially need "negative" tests. Fixes bugzilla #29697 and piglit test glsl-link-array-01.
2010-08-26glsl: Move is_built_in flag from ir_function_signature to ir_function.Kenneth Graunke
Also rename it to "is_builtin" for consistency. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-08-25ir_to_mesa: Convert this code to using linker.cpp's uniform locations.Eric Anholt
Fixes: glsl-fs-uniform-array-4.
2010-08-25glsl: Make uniform linking generate separate uniforms for struct members.Eric Anholt
This is a step towards making the linker code usable as our uniform setup, instead of having it wedged into ir_to_mesa.cpp.
2010-08-24glsl: Include main/core.h.Chia-I Wu
Make glsl include only main/core.h from core mesa.
2010-08-23glsl: Count function call outvals as writing to variables for linker checks.Eric Anholt
Fixes: glsl-vs-position-outval. Bug #28138 (regnum online)
2010-08-23glsl: Trim the size of uniform arrays to the maximum element used.Eric Anholt
Fixes glsl-getactiveuniform-array-size.
2010-08-18glsl: Also strdup the names of uniform list entries for >vec4 types.Eric Anholt
Fixes double-free since the fix to free all of the uniform list.
2010-08-18mesa: Free old linked shaders when relinking new shaders.Eric Anholt
2010-08-17linker: Demote user-defined varyings in the VS-only caseIan Romanick
Fixes piglit test case glsl-vs-ff-frag and bugzilla #29623.
2010-08-16linker: Include compiler.h to avoid spurious warnings about INLINEIan Romanick
2010-08-13glsl2: Move the common optimization passes to a helper function.Eric Anholt
These are passes that we expect all codegen to be happy with. The other lowering passes for Mesa IR are moved to the Mesa IR generator.
2010-08-13linker: Assign attrib location 0 if gl_Vertex is not usedIan Romanick
If gl_Vertex is not used in the shader, then attribute location 0 is available for use. Fixes piglit test case glsl-getattriblocation (bugzilla #29540).
2010-08-09glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1))Eric Anholt
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.
2010-08-09glsl2: Add constant propagation.Eric Anholt
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.
2010-08-06glsl2: Don't assert in a couple of places when encountering sampler arrays.Eric Anholt
Fixes glean shaderAPI.
2010-08-05glsl2: Add a pass to convert exp and log to exp2 and log2.Eric Anholt
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
2010-08-05ir_structure_splitting: New pass to chop structures into their components.Eric Anholt
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.
2010-08-05glsl2: Add a pass for removing unused functions.Eric Anholt
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%).
2010-08-04glsl2: Remove the shader_in/shader_out tracking separate from var->mode.Eric Anholt
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.
2010-08-04glsl2: Use linked ir_constant_variable after linking, instead of unlinked.Eric Anholt
2010-08-04glsl2: Don't try to assign locations for samplers during linking.Eric Anholt
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.
2010-08-04glsl2: Make the clone() method take a talloc context.Eric Anholt
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.
2010-08-02glsl2: Give the path within src/mesa/ for headers instead of relying on -I.Aras Pranckevicius
2010-07-31glsl2: Do algebraic optimizations after linking as well.Eric Anholt
Linking brings in inlining of builtins, so we weren't catching the (rcp(/sqrt(x)) -> rsq(x)) without it.
2010-07-31glsl2: Add new tree grafting optimization pass.Eric Anholt
2010-07-29glsl2: Fix spelling of "sentinel."Eric Anholt
2010-07-28glsl2: Fail linking where the FS reads a varying that the VS doesn't write.Eric Anholt
Fixes: glsl1-varying read but not written glsl1-varying var mismatch
2010-07-28glsl2: Unmark unwritten varyings as varying.Eric Anholt
This fixes an assertion failure in ir_to_mesa, and the varying won't take up varying space.