summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Refresh autogenerated lexer and parser files.Ian Romanick2011-01-063-2649/+2700
| | | | For the previous commit.
* glsl: Support the 'invariant(all)' pragmaIan Romanick2011-01-064-0/+42
| | | | | | | | | | | | | Previously the 'STDGL invariant(all)' pragma added in GLSL 1.20 was simply ignored by the compiler. This adds support for setting all variable invariant. In GLSL 1.10 and GLSL ES 1.00 the pragma is ignored, per the specs, but a warning is generated. Fixes piglit test glsl-invariant-pragma and bugzilla #31925. NOTE: This is a candidate for the 7.9 and 7.10 branches.
* glsl: Allow less restrictive uses of sampler array indexing in GLSL <= 1.20Ian Romanick2011-01-061-4/+24
| | | | | | | | | | | | | | | | | | GLSL 1.10 and 1.20 allow any sort of sampler array indexing. Restrictions were added in GLSL 1.30. Commit f0f2ec4d added support for the 1.30 restrictions, but it broke some valid 1.10/1.20 shaders. This changes the error to a warning in GLSL 1.10, GLSL 1.20, and GLSL ES 1.00. There are some spurious whitespace changes in this commit. I changed the layout (and wording) of the error message so that all three cases would be similar. The 1.10/1.20 and 1.30 text is the same. The only difference is that one is an error, and the other is a warning. The GLSL ES 1.00 wording is similar but not quite the same. Fixes piglit test spec/glsl-1.10/compiler/constant-expressions/sampler-array-index-02.frag and bugzilla #32374.
* glcpp: Add test for recursive #define.Vinson Lee2011-01-041-0/+3
|
* glcpp: Add division by zero test cases.Vinson Lee2011-01-042-0/+4
|
* glsl: Check that integer vertex outputs are qualified with flatChad Versace2011-01-041-0/+19
| | | | | | | | | | Perform this check in ast_declarator_list::hir(). From section 4.3.6 of the GLSL 1.30 spec: "If a vertex output is a signed or unsigned integer or integer vector, then it must be qualified with the interpolation qualifier flat."
* glsl: Allow redeclaration of gl_Color and its variants in GLSL 1.30Chad Versace2011-01-041-0/+21
| | | | | | | | | | | | | Allow redeclaration of the following built-in variables with an interpolation qualifier in language versions >= 1.30: * gl_FrontColor * gl_BackColor * gl_FrontSecondaryColor * gl_BackSecondaryColor * gl_Color * gl_SecondaryColor See section 4.3.7 of the GLSL 1.30 spec.
* glsl: Comment ast_type_qualifier.flagsChad Versace2011-01-041-1/+5
|
* glsl: Really remove unused "instructions" parameter.Kenneth Graunke2011-01-011-2/+1
| | | | | I forgot about this file, and it didn't show up until I tried to do "make builtins" from a clean build.
* glsl: Remove unused "instructions" parameter.Kenneth Graunke2011-01-014-22/+17
| | | | | | I think was used long ago, when we actually read the builtins into the shader's instruction stream directly, rather than creating a separate shader and linking the two. It doesn't seem to serve any purpose now.
* glcpp: Add negative tests for redefintions with valueless macros.Vinson Lee2010-12-272-0/+15
|
* glsl: Support if-flattening beyond a given maximum nesting depth.Kenneth Graunke2010-12-272-6/+38
| | | | | | | | | | | This adds a new optional max_depth parameter (defaulting to 0) to lower_if_to_cond_assign, and makes the pass only flatten if-statements nested deeper than that. By default, all if-statements will be flattened, just like before. This patch also renames do_if_to_cond_assign to lower_if_to_cond_assign, to match the new naming conventions.
* Refresh autogenerated file builtin_function.cpp.Kenneth Graunke2010-12-171-87/+34
| | | | | NOTE: The 7.9 and 7.10 branches will need their builtins refreshed too. Rather than cherry-picking this commit, run 'make builtins'.
* glsl/builtins: Compute the correct value for smoothstep(vec, vec, vec).Kenneth Graunke2010-12-171-87/+34
| | | | | | | | 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.
* glsl: Expose a public glsl_type::void_type const pointer.Kenneth Graunke2010-12-173-4/+6
| | | | This is analogous to glsl_type::int_type and all the others.
* glsl: new glsl_strtod() wrapper to fix decimal point interpretationBrian Paul2010-12-148-229/+329
| | | | | | | | 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.
* linker: Allow built-in arrays to have different sizes between shader stagesIan Romanick2010-12-131-8/+29
| | | | Fixes pitlit test glsl-link-varying-TexCoord (bugzilla #31650).
* glsl: Inherrit type of declared variable from initializer after processing ↵Ian Romanick2010-12-101-8/+17
| | | | | | | | | | | 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.
* glsl: Minor clean-up in validate_assignmentIan Romanick2010-12-101-6/+3
| | | | | This code has been changed around a lot, and there were some temporary variables left around from previous versions.
* glsl: Unroll loops with conditional breaks anywhere (not just the end)7.10-branchpointLuca Barbieri2010-12-091-46/+68
| | | | | | | | | | | 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 <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Consider the "else" branch when looking for loop breaks.Kenneth Graunke2010-12-091-1/+1
| | | | | | | 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.
* glsl: Clean up code by adding a new is_break() function.Kenneth Graunke2010-12-091-6/+11
|
* glsl: Correct the marking of InputsRead/OutputsWritten on in/out matrices.Eric Anholt2010-12-091-20/+15
| | | | | | | | 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.
* glsl: fix lowering conditional returns in subroutinesFabian Bieler2010-12-091-1/+5
| | | | | | this fix applies to the lower_sub_return 'branch' of the lower_jumps pass Fixes piglit tests glsl-functions-5 and glsl-functions-6.
* glsl: In ast_to_hir, check sampler array indexingChad Versace2010-12-081-0/+14
| | | | | | | | | 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 [...]."
* linker: Fix regressions caused by previous commitIan Romanick2010-12-071-12/+16
| | | | | | | | | 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.
* linker: Ensure that unsized arrays have a size after linkingIan Romanick2010-12-071-1/+27
| | | | | | | 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.
* glsl: Inherrit type of declared variable from initializerIan Romanick2010-12-071-0/+18
| | | | | | | | | | | | | 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.
* glsl: Ensure that equality comparisons don't return a NULL IR treeIan Romanick2010-12-071-16/+19
| | | | | | | 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.
* Refresh autogenerated glcpp parser.Kenneth Graunke2010-12-071-47/+46
|
* glcpp: Don't emit SPACE tokens in conditional_tokens production.Kenneth Graunke2010-12-071-1/+0
| | | | | | | | Fixes glslparsertest defined-01.vert. Reported-by: José Fonseca <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Acked-by: Carl Worth <[email protected]>
* glsl: Properly add functions during lazy built-in prototype importing.Kenneth Graunke2010-12-063-7/+25
| | | | | | | | | | | | 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.
* glsl: Factor out code which emits a new function into the IR stream.Kenneth Graunke2010-12-062-18/+26
| | | | A future commit will use the newly created function in a second place.
* ir_print_visitor: Print out constant structure values.Kenneth Graunke2010-12-031-0/+9
| | | | In the form (constant type ((field1 value) (field2 value) ...))
* glsl: Fix flipped return of has_value() for array constants.Eric Anholt2010-12-021-1/+1
| | | | Fixes glsl-array-uniform.
* glsl: Fix linker bug in cross_validate_globals()Chad Versace2010-12-011-0/+7
| | | | | | Cause linking to fail if a global has mismatching invariant qualifiers. See https://bugs.freedesktop.org/show_bug.cgi?id=30261
* glsl: Mark the array access for whole-array comparisons.Eric Anholt2010-12-011-0/+14
| | | | | | 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.
* glsl: Lower ir_binop_pow to a sequence of EXP2 and LOG2Ian Romanick2010-12-012-2/+29
|
* glsl: Use M_LOG2E constant instead of calling log2Ian Romanick2010-12-011-3/+3
|
* glsl: Add comments to lower_jumps (from the commit message).Kenneth Graunke2010-12-011-0/+31
| | | | | This is essentially Luca's commit message, but placed at the top of the file.
* glsl: Remove "discard" support from lower_jumps.Kenneth Graunke2010-12-011-11/+2
| | | | | | | | | | | | 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.
* glsl: Add a lowering pass to move discards out of if-statements.Kenneth Graunke2010-12-014-0/+201
| | | | | | | 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.
* glsl: Add an optimization pass to simplify discards.Kenneth Graunke2010-12-015-0/+184
| | | | NOTE: This is a candidate for the 7.9 branch.
* glsl/linker: Free any IR discarded by optimization passes.Kenneth Graunke2010-11-301-4/+19
| | | | | | | | | | | 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.
* glsl: Remove anti-built-in hacks from the print visitor.Kenneth Graunke2010-11-301-7/+0
| | | | | Now that we only import built-in signatures that are actually used, printing them is reasonable.
* glsl: Lazily import built-in function prototypes.Kenneth Graunke2010-11-303-31/+40
| | | | | | | | 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.
* glsl: Refactor out cloning of function prototypes.Kenneth Graunke2010-11-303-27/+24
| | | | This allows us to reuse some code and will be useful later.
* glsl: fix matrix type check in ir_algebraicAras Pranckevicius2010-11-301-2/+2
| | | | Fixes glsl-mat-mul-1.
* glsl: Quiet unreachable no-return-from-function warning.Eric Anholt2010-11-301-0/+2
|
* glsl: Fix structure and array comparisions.Eric Anholt2010-11-301-2/+70
| | | | | | | | | | | | | | | 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