summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* linker: Reject shaders that use too many varyingsIan Romanick2011-06-201-5/+36
| | | | | | | | | | | | Previously it was up to the driver or later code generator to reject these shaders. It turns out that nobody did this. This will need changes to support geometry shaders. NOTE: This is a candidate for the stable branches. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37743 Reviewed-by: Kenneth Graunke <[email protected]>
* scons: make embedding orthogonal to the platformJosé Fonseca2011-06-171-2/+2
| | | | To enable embedding in platforms other than linux.
* glsl/builtins: Actually implement int/ivec variants of abs().Kenneth Graunke2011-06-141-0/+20
| | | | | | | Signed-off-by: Kenneth Graunke <[email protected]> NOTE: This is a candidate for stable release branches (and don't forget to re-run "make builtins" after cherry-picking.)
* glsl/generate_builtins.py: Remove regexp to kill pointer addresses.Kenneth Graunke2011-06-141-4/+0
| | | | | | | | | Commit 56ef62d9885f805bbfb2243dc860ff425d5b4d3b "glsl: Generate readable unique names at print time." changed ir_print_visitor to not generate @0x1234567 suffixes except where necessary. So there's no need to manually remove them. Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Fix incorrect optimization of instructions before discard statements.Eric Anholt2011-06-101-3/+17
| | | | | | | | The function was named "find_unconditional_discard", but didn't actually check that the discard statement found was unconditional. Fixes piglit glsl-fs-discard-04. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: fixed printing of structure constants.Paul Berry2011-06-031-1/+1
| | | | | | | | ir_print_visitor::visit(ir_constant *) was failing to index properly into ir->type->fields.structure, so the first field name was being reprinted for every field in the structure. Signed-off-by: Brian Paul <[email protected]>
* AST dump: fixed printing of conditionals.Paul Berry2011-06-031-1/+1
| | | | | | | ast_expression::print() had an incorrect index into the subexpressions array, so (a ? b : c) was being incorrectly rendered as (a ? b : b). Signed-off-by: Brian Paul <[email protected]>
* mesa: check that flex/bison are installedBrian Paul2011-05-181-4/+4
| | | | | | Fixes https://bugs.freedesktop.org/show_bug.cgi?id=36651 NOTE: This is a candidate for the 7.10 branch.
* glsl: Add compiler support for ARB_shader_texture_lod.Kenneth Graunke2011-05-096-0/+188
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Tested-by: Marek Olšák <[email protected]>
* glsl: Remove extra newline from error messageIan Romanick2011-05-031-1/+1
|
* mesa: implement AMD_shader_stencil_exportMarek Olšák2011-05-033-0/+32
| | | | | | | | It's just an alias of the ARB variant with some GLSL compiler changes. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Fix typos in comments.Bryan Cain2011-04-231-6/+6
|
* glsl/ast_to_hir: Only use the local 'type' variable as a temporary.Kenneth Graunke2011-04-201-20/+4
| | | | | | | | | Lots of code (deleted by this patch) tried to make type == result->type, but not all cases did. Don't pretend; just use result->type. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: fix conversions from uint to bool and from float/bool to uintBryan Cain2011-04-181-3/+3
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Ian Romanick <[email protected]>
* glsl: 80-column wrapping and whitespace fixesIan Romanick2011-04-181-1/+5
|
* glsl: Emit a warning when the left-hand operand of a comma has no effectIan Romanick2011-04-181-1/+35
| | | | | | | | | | | | | | | | | The expression x = y, 5, 3; will generate 0:7(9): warning: left-hand operand of comma expression has no effect The warning is only emitted for the left-hand operands, becuase the right-most operand is the result of the expression. This could be used in an assignment, etc. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Fix attempts to expand recursive macros infinitely (bug #32835).Carl Worth2011-04-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 095-recursive-define test case was triggering infinite recursion with the following test case: #define A(a, b) B(a, b) #define C A(0, C) C Here's what was happening: 1. "C" was pushed onto the active list to expand the C node 2. While expanding the "0" argument, the active list would be emptied by the code at the end of _glcpp_parser_expand_token_list 3. When expanding the "C" argument, the active list was now empty, so lather, rinse, repeat. We fix this by adjusting the final popping at the end of _glcpp_parser_expand_token_list to never pop more nodes then this particular invocation had pushed itself. This is as simple as saving the original state of the active list, and then interrupting the popping when we reach this same state. With this fix, all of the glcpp-test tests now pass. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32835 Signed-off-by: Carl Worth <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-and-tested-by: Kenneth Graunke <[email protected]>
* Add expected file for 095-recursive-define test case.Carl Worth2011-04-141-0/+4
| | | | | | | | | | It's clear enough that the current segmentation fault isn't what we want. And it's also very easy to know what we do want here, (just check with any functional C preprocessor such as "gcc -E"). Add the desired output as an expected file so that the test suite gives useful output, (showing the omitted output and the segfault), rather than just reporting "No such file" for the expected file.
* glcpp: Simplify calling convention of parser's active_list functionsCarl Worth2011-04-141-38/+38
| | | | | | | | | | | | These were all written as generic list functions, (accepting and returning a list to act upon). But they were only ever used with parser->active as the list. By simply accepting the parser itself, these functions can update parser->active and now return nothing at all. This makes the code a bit more compact. And hopefully the code is no less readable since the functions are also now renamed to have "_parser_active" in the name for better correlation with nearby tests of the parser->active field.
* glcpp: Add --valgrind option to the glcpp-test utilityCarl Worth2011-04-141-16/+46
| | | | | | | | | | | The common case for this test suite is to quickly test that everything returns the correct results. In this case, the second run of the test suite under valgrind was just annoying, (and the user would often interrupt it). Now, do what is wanted in the common case by default (just run the test suite), and require a run with "glcpp-test --valgrind" in order to test with valgrind.
* Add an expected file for 084-unbalanced-parenthesesCarl Worth2011-04-141-0/+2
| | | | | | | | | | | | The expected file here captures the current behavior of glcpp (which is to generate an obscure "syntax error, unexpected $end" diagnostic for this case). It would certainly be better for glcpp to generate a nicer diagnostic, (such as "missing closing parenthesis in function-like macro definition" or so), but the current behavior is at least correct, and expected. So we can make the test suite more useful by marking the current behavior as expected.
* Add an expected file for 094-divide-by-zero-short-circuitCarl Worth2011-04-142-0/+26
| | | | | | | | | | | The expected file here captures the current behavior of glcpp (which is to generate a division-by-zero error) for this case. It's easy to argue that it should be short-circuiting the evaluation and not generating the diagnostic (which happens to be what gcc does). But it doesn't seem like we should force this behavior on our pre-processor, (and, as always, the GLSL specification of the pre-processor is too vague on this point).
* Add an expected file for 093-divide-by-zeroCarl Worth2011-04-141-0/+4
| | | | | | This test is behaving just fine already---it's generating an informative diagnostic, ("error: division by 0 in preprocessor directive"), so adding this in the expected file makes things pass.
* glsl: Perform type checking on "^^" operands.Eric Anholt2011-04-131-3/+10
| | | | | | | | | | | We were letting any old operand through, which generally resulted in assertion failures later. Fixes array-logical-xor.vert. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: When we've emitted a semantic error for ==, return a bool constant.Eric Anholt2011-04-131-3/+7
| | | | | | | | | | | This prevents later errors (including an assertion failure) from cascading the failure. Fixes invalid-equality-04.vert. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33303 Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Semantically check the RHS of `||' even when short-circuiting.Eric Anholt2011-04-131-6/+5
| | | | | | | | | | | We just do the AST-to-HIR processing, and only push the instructions if needed in the constant false case. Fixes glslparsertest/glsl2/logic-02.frag Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Semantically check the RHS of `&&' even when short-circuiting.Eric Anholt2011-04-131-6/+6
| | | | | | | | | | | We just do the AST-to-HIR processing, and only push the instructions if needed in the constant true case. Fixes glslparsertest/glsl2/logic-01.frag Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Avoid cascading errors when looking for a scalar boolean and failing.Eric Anholt2011-04-131-76/+48
| | | | | | | | | | | | | | | By always using a boolean, we should generally avoid further complaints. The failure case I see is logic_not, where the user might understandably make the mistake of using `!' on a boolean vector (like a piglit case did recently!), and then get a further complaint that the new boolean type doesn't match the bvec it gets assigned to. Fixes invalid-logic-not-06.vert (assertion failure when the bad type ends up in an expression and ir_constant_expression gets angry). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33314 Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/opt_cpe: Reenable opt_copy_propagation_elements.cpp pass.Eric Anholt2011-04-131-1/+1
|
* glsl/opt_cpe: Fix a crash when a kill kills for two reasons.Eric Anholt2011-04-131-1/+3
| | | | | | | Fixes glsl-copy-propagation-loop-2 when this optimization pass is re-enabled. Reported-by: David Lamparter <[email protected]>
* glsl/opt_cpe: Kill when the assignment isn't something we recognize.Eric Anholt2011-04-131-2/+9
| | | | | | | | | A few GLES2 tests tripped over this when using array dereferences to hit channels on the LHS (see piglit test glsl-copy-propagation-vector-indexing). We wouldn't find the ir_dereference_variable, and assume that that meant that it wasn't an assignment to a scalar/vector, and thus not notice that the variable had been changed.
* glsl: Make GL_ARB_shader_stencil_export enable block be similar to other blocksIan Romanick2011-04-111-7/+7
| | | | | Tested-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Only let a shader enable GL_ARB_draw_instanced if the driver supports itIan Romanick2011-04-111-6/+5
| | | | | | | | Also make the GL_ARB_draw_instanced block follow the same pattern as the other blocks. Tested-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Calcluate Mesa state slots in front-end instead of back-endIan Romanick2011-03-294-3/+94
| | | | | | | | | | | | This should be the last bit of infrastructure changes before generating GLSL IR for assembly shaders. This commit leaves some odd code formatting in ir_to_mesa and brw_fs. This was done to minimize whitespace changes / reindentation in some loops. The following commit will restore formatting sanity. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Move _mesa_builtin_uniform_desc from uniforms.c to ir_variable.cppIan Romanick2011-03-291-0/+253
| | | | | | | | This array is going to be used in the main compiler soon. Leaving them uniforms.c caused problems for building the stand-alone compiler. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* glsl: Accept precision qualifiers on sampler types, but only in ES.Kenneth Graunke2011-03-261-2/+9
| | | | | | | | | | GLSL 1.30 states clearly that only float and int are allowed, while the GLSL ES specification's issues section states that sampler types may take precision qualifiers. Fixes compilation failures in 3DMarkMobileES 2.0 and GLBenchmark 2.0. NOTE: This is a candidate for stable release branches.
* glsl: Generate readable unique names at print time.Kenneth Graunke2011-03-252-11/+63
| | | | | | | | | | | | | | | | | | | | Since GLSL IR allows multiple ir_variables to share the same name, we need to generate unique names when printing the IR. Previously, we always used %s@%p, appending the ir_variable's memory address. While this worked, it had two drawbacks: - When there aren't duplicates, the extra "@0x669a3e88" is useless and makes the code harder to read. - Real duplicates were hard to tell apart: channel_expressions@0x6699e3c8 vs. channel_expressions@0x6699ddd8 We now append @2, @3, @4, and so on, but only where necessary to distinguish duplicates. Since we only do this at print time, any performance impact is irrelevant. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make add_variable, add_uniform, et. al. have similar signaturesIan Romanick2011-03-251-106/+109
| | | | | | While making some other changes in this area I was finding it annoying each of these functions took mostly the same set of parameters in differing orders.
* glsl: Fix off-by-one error setting max_array_access for non-constant indexingIan Romanick2011-03-251-1/+1
| | | | NOTE: This is a candidate for the stable branches.
* glsl: Add array access bounds checking to ir_validateIan Romanick2011-03-251-0/+15
|
* glsl: Add void to _mesa_destroy_shader_compiler() argument list.José Fonseca2011-03-251-2/+2
| | | | | At least MSVC sees a distinction between foo() and foo(void) and warns about it.
* autoconf: don't use CFLAGS for cpp filesTobias Droste2011-03-161-1/+1
| | | | Signed-off-by: Tobias Droste <[email protected]>
* glsl2: Silence unused added variable gcc warning.José Fonseca2011-03-161-0/+1
|
* glsl: add cast to silence signed/unsigned comparison warningBrian Paul2011-03-151-1/+1
|
* glsl: Only allow unsized array assignment in an initializerIan Romanick2011-03-151-14/+17
| | | | | | | | | | | It should have been a tip when the spec says "However, implicitly sized arrays cannot be assigned to. Note, this is a rare case that *initializers and assignments appear to have different semantics*." (empahsis mine) Fixes bugzilla #34367. NOTE: This is a candidate for stable release branches.
* glsl: Skip processing the first function's body in do_dead_functions().Eric Anholt2011-03-151-1/+10
| | | | It can't call anything, so there's no point.
* glsl: Whitespace fixup in opt_dead_functions.cpp.Eric Anholt2011-03-151-106/+108
|
* glsl: Skip processing of expression trees in discard simplification.Eric Anholt2011-03-151-0/+10
| | | | It only cares about "if", "loop", and "discard".
* glsl: Reduce processing of expression trees in do_structure_splitting.Eric Anholt2011-03-151-0/+6
| | | | | | Most of the time we don't have a non-uniform struct variable in the shader, so this cuts the time spent in do_structure_splitting during glean texCombine by about 2/3.
* glsl: Skip processing expression trees in do_if_simplification().Eric Anholt2011-03-151-0/+10
| | | | Reduces time spent in this during glean texCombine by about 2/3.