summaryrefslogtreecommitdiff
path: root/src/glsl
AgeCommit message (Collapse)Author
2010-12-17Refresh autogenerated file builtin_function.cpp.Kenneth Graunke
NOTE: The 7.9 and 7.10 branches will need their builtins refreshed too. Rather than cherry-picking this commit, run 'make builtins'.
2010-12-17glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).Kenneth Graunke
These mistakenly computed 't' instead of t * t * (3.0 - 2.0 * t). Also, properly vectorize the smoothstep(float, float, vec) variants. NOTE: This is a candidate for the 7.9 and 7.10 branches.
2010-12-17glsl: Expose a public glsl_type::void_type const pointer.Kenneth Graunke
This is analogous to glsl_type::int_type and all the others.
2010-12-14glsl: new glsl_strtod() wrapper to fix decimal point interpretationBrian Paul
We always want to use '.' as the decimal point. See http://bugs.freedesktop.org/show_bug.cgi?id=24531 NOTE: this is a candidate for the 7.10 branch.
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-10glsl: Inherrit type of declared variable from initializer after processing ↵Ian Romanick
assignment do_assignment may apply implicit conversions to coerce the base type of initializer to the base type of the variable being declared. Fixes piglit test glsl-implicit-conversion-02 (bugzilla #32287). This probably also fixes bugzilla #32273. NOTE: This is a candidate for the 7.9 branch and the 7.10 branch.
2010-12-10glsl: Minor clean-up in validate_assignmentIan Romanick
This code has been changed around a lot, and there were some temporary variables left around from previous versions.
2010-12-09glsl: Unroll loops with conditional breaks anywhere (not just the end)Luca Barbieri
Currently we only unroll loops with conditional breaks at the end, which is the form that lower_jumps generates. However, if breaks are not lowered, they tend to appear at the beginning, so add support for a conditional break anywhere. Signed-off-by: Luca Barbieri <luca@luca-barbieri.com> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2010-12-09glsl: Consider the "else" branch when looking for loop breaks.Kenneth Graunke
Found this bug by code inspection. Based off the comments just before this code, the intent is to find whether the break exists in the "then" branch or the "else" branch. However, the code actually looked at the last instruction in the "then" branch twice.
2010-12-09glsl: Clean up code by adding a new is_break() function.Kenneth Graunke
2010-12-09glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.Eric Anholt
If you used a constant array index to access the matrix, we'd flag a bunch of wrong inputs/outputs as being used because the index was multiplied by matrix columns and the actual used index was left out. Fixes glsl-mat-attribute.
2010-12-09glsl: fix lowering conditional returns in subroutinesFabian Bieler
this fix applies to the lower_sub_return 'branch' of the lower_jumps pass Fixes piglit tests glsl-functions-5 and glsl-functions-6.
2010-12-08glsl: In ast_to_hir, check sampler array indexingChad Versace
Raise error if a sampler array is indexed with a non-constant expression. From section 4.1.7 of the GLSL 1.30 spec: "Samplers aggregated into arrays within a shader (using square brackets [ ]) can only be indexed with integral constant expressions [...]."
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-07glsl: Inherrit type of declared variable from initializerIan Romanick
Types of declared variables and their initializer must match excatly except for unsized arrays. Previously the type inherritance for unsized arrays happened implicitly in the emitted assignment. However, this assignment is never emitted for uniforms. Now that type is explicitly copied unconditionally. Fixes piglit test array-compare-04.vert (bugzilla #32035) and glsl-array-uniform-length (bugzilla #31985). NOTE: This is a candidate for the 7.9 branch.
2010-12-07glsl: Ensure that equality comparisons don't return a NULL IR treeIan Romanick
This fixes bugzilla #32035 and piglit test case array-compare-01 and array-compare-02. NOTE: This is a candidate for the 7.9 branch.
2010-12-07Refresh autogenerated glcpp parser.Kenneth Graunke
2010-12-07glcpp: Don't emit SPACE tokens in conditional_tokens production.Kenneth Graunke
Fixes glslparsertest defined-01.vert. Reported-by: José Fonseca <jfonseca@vmware.com> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Carl Worth <cworth@cworth.org>
2010-12-06glsl: Properly add functions during lazy built-in prototype importing.Kenneth Graunke
The original lazy built-in importing patch did not add the newly created function to the symbol table, nor actually emit it into the IR stream. Adding it to the symbol table is non-trivial since importing occurs when generating some ir_call in a nested scope. A new add_global_function method, backed by new symbol_table code in the previous patch, handles this. Fixes bug #32030.
2010-12-06glsl: Factor out code which emits a new function into the IR stream.Kenneth Graunke
A future commit will use the newly created function in a second place.
2010-12-03ir_print_visitor: Print out constant structure values.Kenneth Graunke
In the form (constant type ((field1 value) (field2 value) ...))
2010-12-02glsl: Fix flipped return of has_value() for array constants.Eric Anholt
Fixes glsl-array-uniform.
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-12-01glsl: Mark the array access for whole-array comparisons.Eric Anholt
By not doing so, the uniform contents of glsl-uniform-non-uniform-array-compare.shader_test was getting thrown out since nobody was recorded as dereferencing the array.
2010-12-01glsl: Lower ir_binop_pow to a sequence of EXP2 and LOG2Ian Romanick
2010-12-01glsl: Use M_LOG2E constant instead of calling log2Ian Romanick
2010-12-01glsl: Add comments to lower_jumps (from the commit message).Kenneth Graunke
This is essentially Luca's commit message, but placed at the top of the file.
2010-12-01glsl: Remove "discard" support from lower_jumps.Kenneth Graunke
The new lower_discard and opt_discard_simplification passes should handle all the necessary transformations, so lower_jumps doesn't need to support it. Also, lower_jumps incorrectly handled conditional discards - it would unconditionally truncate all code after the discard. Rather than fixing the bug, simply remove the code. NOTE: This is a candidate for the 7.9 branch.
2010-12-01glsl: Add a lowering pass to move discards out of if-statements.Kenneth Graunke
This should allow lower_if_to_cond_assign to work in the presence of discards, fixing bug #31690 and likely #31983. NOTE: This is a candidate for the 7.9 branch.
2010-12-01glsl: Add an optimization pass to simplify discards.Kenneth Graunke
NOTE: This is a candidate for the 7.9 branch.
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-30glsl: Remove anti-built-in hacks from the print visitor.Kenneth Graunke
Now that we only import built-in signatures that are actually used, printing them is reasonable.
2010-11-30glsl: Lazily import built-in function prototypes.Kenneth Graunke
This makes a very simple 1.30 shader go from 196k of memory to 9k. NOTE: This -may- be a candidate for the 7.9 branch, as the benefit is substantial. However, it's not a simple change, so it may be wiser to wait for 7.10.
2010-11-30glsl: Refactor out cloning of function prototypes.Kenneth Graunke
This allows us to reuse some code and will be useful later.
2010-11-30glsl: fix matrix type check in ir_algebraicAras Pranckevicius
Fixes glsl-mat-mul-1.
2010-11-30glsl: Quiet unreachable no-return-from-function warning.Eric Anholt
2010-11-30glsl: Fix structure and array comparisions.Eric Anholt
We were trying to emit a single ir_expression to compare the whole thing. The backends (ir_to_mesa.cpp and brw_fs.cpp so far) expected ir_binop_any_nequal or ir_binop_all_equal to apply to at most a vector (with matrices broken down by the lowering pass). Break them down to a bunch of ORed or ANDed any_nequals/all_equals. Fixes: glsl-array-compare glsl-array-compare-02 glsl-fs-struct-equal glsl-fs-struct-notequal Bug #31909
2010-11-30glsl: Add a helper constructor for expressions that works out result type.Eric Anholt
This doesn't cover all expressions or all operand types, but it will complain if you overreach and it allows for much greater slack on the programmer's part.
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-11-25glsl: Add a virtual as_discard() method.Kenneth Graunke
NOTE: This is candidate for the 7.9 branch.
2010-11-25glsl: Use do_common_optimization in the standalone compiler.Kenneth Graunke
NOTE: This is a candidate for the 7.9 branch.
2010-11-25glsl: Don't inline function prototypes.Kenneth Graunke
Currently, the standalone compiler tries to do function inlining before linking shaders (including linking against the built-in functions). This resulted in the built-in function _prototypes_ being inlined rather than the actual function definition. This is only known to fix a bug in the standalone compiler; most programs should be unaffected. Still, it seems like a good idea. NOTE: This is a candidate for the 7.9 branch.
2010-11-19glsl: Add a helper function for determining if an rvalue could be a saturate.Eric Anholt
Hardware pretty commonly has saturate modifiers on instructions, and this can be used in codegen to produce those, without everyone else needing to understand clamping other than min and max.
2010-11-19glsl: Fix type of label 'default' in switch statement.Vinson Lee
2010-11-19glsl: Add lower_vector.cpp to SConscript.Vinson Lee
2010-11-19glsl: Fix matrix constructors with vector parametersIan Romanick
When the semantics of write masks in assignments were changed, this code was not correctly updated. Fixes piglit test glsl-mat-from-vec-ctor-01.
2010-11-19glsl: Combine many instruction lowering passes into one.Kenneth Graunke
This should save on the overhead of tree-walking and provide a convenient place to add more instruction lowering in the future. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-11-19glsl: Simplify a type check by using type->is_integer().Kenneth Graunke