summaryrefslogtreecommitdiff
path: root/src/glsl/linker.cpp
AgeCommit message (Collapse)Author
2011-02-21Use C-style system headers in C++ code to avoid issues with std:: namespaceIan Romanick
2011-02-15linker: Fix off-by-one error implicit array sizingIan Romanick
Arrays are zero based. If the highest element accessed is 6, the array needs to have 7 elements. Fixes piglit test glsl-fs-implicit-array-size-03 and bugzilla #34198. NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-02-04linker: Generate link errors when ES shaders are missing stagesIan Romanick
ES requires that a vertex shader and a fragment shader be present. Fixes bugzilla #32214.
2011-01-31glsl: Introduce a new "const_in" variable mode.Kenneth Graunke
This annotation is for an "in" function parameter for which it is only legal to pass constant expressions. The only known example of this, currently, is the textureOffset functions. This should never be used for globals.
2011-01-31Convert everything from the talloc API to the ralloc API.Kenneth Graunke
2011-01-26glsl: Raise linking error if gl_FragDepth layout is inconsistentChad Versace
From the AMD_conservative_depth spec: If gl_FragDepth is redeclared in any fragment shader in a program, it must be redeclared in all fragment shaders in that program that have static assignments to gl_FragDepth. All redeclarations of gl_FragDepth in all fragment shaders in a single program must have the same set of qualifiers.
2011-01-25linker: Propagate max_array_access while linking functionsIan Romanick
Update the max_array_access of a global as functions that use that global are pulled into the linked shader. Fixes piglit test glsl-fs-implicit-array-size-01 and bugzilla #33219. NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-01-25linker: Set sizes for non-global arrays as wellIan Romanick
Previously only global arrays with implicit sizes would be patched. This causes all arrays that are actually accessed to be sized. Fixes piglit test glsl-fs-implicit-array-size-02. NOTE: This is a candidate for the 7.9 and 7.10 branches.
2011-01-21glsl, i965: Remove unnecessary talloc includes.Kenneth Graunke
These are already picked up by ir.h or glsl_types.h.
2011-01-10glsl: At link-time, check that globals have matching centroid qualifiersChad Versace
Fixes bug 31923: http://bugs.freedesktop.org/show_bug.cgi?id=31923
2010-12-13linker: Allow built-in arrays to have different sizes between shader stagesIan Romanick
Fixes pitlit test glsl-link-varying-TexCoord (bugzilla #31650).
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%).