summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp
Commit message (Collapse)AuthorAgeFilesLines
* mesa: rename the AMD_conservative_depth extension flag to ARBMarek Olšák2011-11-221-1/+1
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glcpp: Add GL_ARB_draw_instanced #define.Morgan Armand2011-11-121-0/+3
|
* glsl: add support for GL_OES_EGL_image_externalChia-I Wu2011-11-031-0/+3
| | | | | | | | | | This extension introduces a new sampler type: samplerExternalOES. texture2D (and texture2DProj) can be used to do a texture look up in an external texture. Reviewed-by: Brian Paul <[email protected]> Acked-by: Jakob Bornecrantz <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glcpp: Add a test for #elif with an undefined macro.Carl Worth2011-09-302-0/+8
| | | | | | | | | | | | | | | | | | As written, this test correctly raises an error for #elif being used with an undefined macro (and not as an argument to "defined"). If the preceding #if were '#if 1' then this diagnositc would correctly be hidden. That allows code such as the following to not raise an error: #ifndef MAYBE_UNDEFINED #elif MAYBE_UNDEFINED < 5 ... #endif So this test case is working as expected already. We add it here just to improve test coverage. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Carl Worth <[email protected]>
* glcpp: Raise error if defining any macro containing two consecutive underscoresCarl Worth2011-09-303-3/+7
| | | | | | | | | | | | | | | | | | The specification reserves any macro name containing two consecutive underscores, (anywhere within the name). Previously, we only raised this error for macro names that started with two underscores. Fix the implementation to check for two underscores anywhere, and also update the corresponding 086-reserved-macro-names test. This also fixes the following two piglit tests: spec/glsl-1.30/preprocessor/reserved/double-underscore-02.frag spec/glsl-1.30/preprocessor/reserved/double-underscore-03.frag Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Carl Worth <[email protected]>
* glcpp: Implement token pasting for non-function-like macrosCarl Worth2011-09-301-36/+47
| | | | | | | | | | | | | | | | | | | | This is as simple as abstracting one existing block of code into a function call and then adding a single call to that function for the case of a non-function-like macro. This fixes the recently-added 097-paste-with-non-function-macro test as well as the following piglit tests: spec/glsl-1.30/preprocessor/concat/concat-01.frag spec/glsl-1.30/preprocessor/concat/concat-02.frag Also, the concat-04.frag test now passes for the right reason. The test is intended to fail the compilation, but before this commit it was failing compilation (and hence passing the test) for the wrong reason. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Carl Worth <[email protected]>
* glcpp: Test a non-function-like macro using the token paste operatorCarl Worth2011-09-302-0/+7
| | | | | | | | Apparently we never implemented this, (but we've got a GLSL 1.30 test in piglit that is exercising this case). Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Carl Worth <[email protected]>
* glcpp: Fix two (or more) successive applications of token pastingCarl Worth2011-09-301-2/+0
| | | | | | | | | | | | | | | | | There was already a loop here to look for multiple token pastes, but it was mistakenly incrementing the iterator counter after performing one paste. Instead, leave the loop iterator in place to coalesce as many tokens as necessary into one. This fixes the recently add 096-paste-twice test as well as the following piglit test: spec/glsl-1.30/preprocessor/concat/concat-03.frag Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Carl Worth <[email protected]>
* glcpp: Add a test for a macro that implements token pasting twice.Carl Worth2011-09-302-0/+7
| | | | | | | This is something that piglit is exercising that currently fails. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Carl Worth <[email protected]>
* glsl: Silence several "warning: unused parameter"Ian Romanick2011-09-091-0/+1
|
* glcpp: Add GL_ARB_conservative_depth #define.Kenneth Graunke2011-08-251-1/+3
| | | | | | | Forgotten in the patch that enabled the extension. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Add compiler support for ARB_shader_texture_lod.Kenneth Graunke2011-05-091-0/+4
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Tested-by: Marek Olšák <[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/glcpp: Use stdio.h instead of unistd.h.José Fonseca2011-03-041-25/+15
|
* glsl: Define YY_NO_UNISTD_H on MSVC.José Fonseca2011-03-041-0/+4
|
* glcpp: Remove trailing contexts from #if rules.Kenneth Graunke2011-03-031-6/+6
| | | | These are now unnecessary.
* glcpp: Rework lexer to use a SKIP state rather than REJECT.Kenneth Graunke2011-03-031-21/+16
| | | | | | | | | | | | | | | | | | | Previously, the rule deleted by this commit was matched every single time (being the longest match). If not skipping, it used REJECT to continue on to the actual correct rule. The flex manual advises against using REJECT where possible, as it is one of the most expensive lexer features. So using it on every match seems undesirable. Perhaps more importantly, it made it necessary for the #if directive rules to contain a look-ahead pattern to make them as long as the (now deleted) "skip the whole line" rule. This patch introduces an exclusive start state, SKIP, to avoid REJECTs. Each time the lexer is called, the code at the top of the rules section will run, implicitly switching the state to the correct one. Fixes piglit tests 16384-consecutive-chars.frag and 16385-consecutive-chars.frag.
* glcpp/tests: Update 063-comments.c.expected to match output.Kenneth Graunke2011-03-031-0/+7
| | | | | | | The expected result has been out of sync with what glcpp produces for some time; glcpp's actual result seems to be correct and is very close to GCC's cpp. Updating this will make it easier to catch regressions in upcoming commits.
* glsl: Remove unused glcpp/Makefile.am.Kenneth Graunke2011-03-021-44/+0
| | | | This is a remnant of when glsl2 lived in its own repository.
* Add generated parser / lexer files to gitignore listsIan Romanick2011-03-011-0/+3
|
* glcpp: Remove files generated by flex and bison from GITIan Romanick2011-03-013-7003/+0
|
* glcpp: regerated filesIan Romanick2011-02-112-181/+193
| | | | | These should have been committed right after fd1252ab, but they were missed. Soon, we'll never have to do this again...
* glcpp: Raise error when modulus is zeroChad Versace2011-02-021-1/+6
| | | | | | | | | | For example, this now raises an error: #define XXX 1 / 0 Fixes bug: https://bugs.freedesktop.org//show_bug.cgi?id=33507 Fixes Piglit test: spec/glsl-1.10/preprocessor/modulus-by-zero.vert NOTE: This is a candidate for the 7.9 and 7.10 branches.
* glsl: regerated filesBrian Paul2011-01-312-125/+118
|
* glsl: make _token_list_is_empty_ignoring_space() staticBrian Paul2011-01-311-1/+1
| | | | To silence warning about missing prototype.
* Convert everything from the talloc API to the ralloc API.Kenneth Graunke2011-01-317-296/+300
|
* Revert "glcpp: Demote "macro redefined" from an error to a warning"Carl Worth2011-01-294-38/+15
| | | | | | | | This reverts commit d3df641f0aba99b0b65ecd4d9b06798bca090a29. The original commit had sat unpushed on my machine for months. By the time I found it again, I had forgotten that we had decided not to use this change after all, (the relevant test was removed long ago).
* glcpp: Demote "macro redefined" from an error to a warningCarl Worth2011-01-284-15/+38
| | | | | | | | | | The GLSL specification is vague here, (just says "as is standard for C++"), though the C specifications seem quite clear that this should be an error. However, an existing piglit test (CorrectPreprocess11.frag) expects this to be a warning, not an error, so we change this, and document in README the deviation from the specification.
* glsl: Refresh autogenerated parser filesChad Versace2011-01-261-0/+2
| | | | | | For commits titled: glcpp: Conditionally define macro GL_AMD_conservative_depth glsl: Add support for AMD_conservative_depth to parser
* glcpp: Conditionally define macro GL_AMD_conservative_depthChad Versace2011-01-261-0/+2
| | | | | Define macro GL_AMD_conservative_depth to 1 when its extension is enabled.
* glcpp: Regenerate parser files.Kenneth Graunke2011-01-211-229/+231
|
* glcpp: Remove use of talloc reference counting.Kenneth Graunke2011-01-211-13/+7
| | | | | We almost always want to simply steal; we only need to copy when copying a token list (in which case we're already cloning stuff anyway).
* glcpp: Refresh autogenerated lexer and parser files.Ian Romanick2011-01-101-184/+181
| | | | For the previous commit.
* glcpp: Generate an error for division by zeroIan Romanick2011-01-101-1/+6
| | | | | | | | | | | | | | | | | | | | When GCC encounters a division by zero in a preprocessor directive, it generates an error. Since the GLSL spec says that the GLSL preprocessor behaves like the C preprocessor, we should generate that same error. It's worth noting that I cannot find any text in the C99 spec that says this should be an error. The only text that I can find is line 5 on page 82 (section 6.5.5 Multiplicative Opertors), which says, "The result of the / operator is the quotient from the division of the first operand by the second; the result of the % operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined." Fixes 093-divide-by-zero.c test and bugzilla #32831. NOTE: This is a candidate for the 7.9 and 7.10 branches.
* glcpp: Regenerate glcpp-parse.cChad Versace2011-01-101-0/+21
|
* glcpp: Fix segfault when validating macro redefinitionsChad Versace2011-01-101-0/+21
| | | | | | | | In _token_list_equal_ignoring_space(token_list_t*, token_list_t*), add a guard that prevents dereferncing a null token list. This fixes test src/glsl/glcpp/tests/092-redefine-macro-error-2.c and Bugzilla #32695.
* 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
|
* glcpp: Add negative tests for redefintions with valueless macros.Vinson Lee2010-12-272-0/+15
|
* 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]>
* Regenerate glcpp parser.Kenneth Graunke2010-11-171-85/+90
|
* glsl: Unconditionally define GL_FRAGMENT_PRECISION_HIGH in ES2 shaders.Kenneth Graunke2010-11-171-1/+6
| | | | | | | | | This is really supposed to be defined only if the driver supports highp in the fragment shader - but all of our current ES2 implementations do. So, just define it. In the future, we'll need to add a flag to gl_context and only define the macro if the flag is set. "Fixes" freedesktop.org bug #31673.
* Refresh autogenerated glcpp parser.Kenneth Graunke2010-11-162-200/+210
|