summaryrefslogtreecommitdiffstats
path: root/src/glsl/s_expression.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Use INFINITY instead of std::numeric_limits<float>::infinity().Matt Turner2015-03-251-2/+2
| | | | Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* glsl: include stdio.h where neededBrian Paul2015-03-051-0/+1
| | | | | Acked-by: Matt Turner <mattst88@gmail.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
* util: add _mesa_strtod and _mesa_strtofChia-I Wu2014-10-301-1/+1
| | | | | | | | | Both core mesa and glsl have their own wrappers for strtof_l. Merge and move them to util/. They are compiled with a C++ compiler so that we can make them thread-safe in a following commit. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Kenneth Graunke <kenneth@whiteacpe.org>
* glsl: Use typed foreach_in_list instead of foreach_list.Matt Turner2014-07-011-4/+2
| | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glsl: Convert piles of foreach_iter to the newer foreach_list macro.Kenneth Graunke2014-01-131-4/+4
| | | | | | | | | | | | | foreach_iter and exec_list_iterators have been deprecated for some time now; we just hadn't ever bothered to convert code to the newer foreach_list and foreach_list_safe macros. In these cases, we aren't editing the list, so we can use foreach_list rather than foreach_list_safe. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glsl: use glsl_strtof() instead of glsl_strtod()Brian Paul2013-01-251-3/+3
| | | | | | Since the result of those calls is always assigned to a float. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* glsl: Fix isinf() for non-C99-compliant compilers.Paul Berry2012-01-191-14/+22
| | | | | | | | | | | | | | | | | | Commit ede60bc4670a8d9c14921c77abee1ac57fc0e6bf (glsl: Add isinf() and isnan() builtins) uses "+INF" in the .ir file to represent infinity. This worked on C99-compliant compilers, since the s-expression reader uses strtod() to read numbers, and C99 requires strtod() to understand "+INF". However, it didn't work on non-C99-compliant compilers such as MSVC. This patch modifies the s-expression reader to explicitly check for "+INF" rather than relying on strtod() to support it. This is a candidate for the 8.0 branch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44767 Tested-by: Morgan Armand <morgan.devel@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* glsl: Avoid massive ralloc_strndup overhead in S-Expression parsing.Kenneth Graunke2011-07-201-18/+46
| | | | | | | | | | | | | | | | | | | | | When parsing S-Expressions, we need to store nul-terminated strings for Symbol nodes. Prior to this patch, we called ralloc_strndup each time we constructed a new s_symbol. It turns out that this is obscenely expensive. Instead, copy the whole buffer before parsing and overwrite it to contain \0 bytes at the appropriate locations. Since atoms are separated by whitespace, (), or ;, we can safely overwrite the character after a Symbol. While much of the buffer may be unused, copying the whole buffer is simple and guaranteed to provide enough space. Prior to this, running piglit-run.py -t glsl tests/quick.tests with GLSL 1.30 enabled took just over 10 minutes on my machine. Now it takes 5. NOTE: This is a candidate for stable release branches (because it will make running comparison tests so much less irritating.) Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
* Use C-style system headers in C++ code to avoid issues with std:: namespaceIan Romanick2011-02-211-3/+0
|
* Convert everything from the talloc API to the ralloc API.Kenneth Graunke2011-01-311-1/+1
|
* glsl/s_expression: Read and ignore Scheme-style comments.Kenneth Graunke2011-01-121-6/+15
| | | | | A single-semicolon until the end of the line, i.e. ; this is a comment.
* ir_reader: Remove s_list::length() method.Kenneth Graunke2011-01-121-10/+0
| | | | | Most code now relies on the pattern matcher rather than this function, and for the only remaining case, not using this saves an iteration.
* ir_reader: Add a pattern matching system and use it everywhere.Kenneth Graunke2011-01-121-0/+46
| | | | | | | | | | | | | | | | | | | Previously, the IR reader was riddled with code that: 1. Checked for the right number of list elements (via a linked list walk) 2. Retrieved references to each component (via ->next->next pointers) 3. Downcasted as necessary to make sure that each sub-component was the right type (i.e. symbol, int, list). 4. Checking that the tag (i.e. "declare") was correct. This was all very ad-hoc and a bit ugly. Error checking had to be done at both steps 1, 3, and 4. Most code didn't even check the tag, relying on the caller to do so. Not all callers did. The new pattern matching module performs the whole process in a single straightforward function call, resulting in shorter, more readable code. Unfortunately, MSVC does not support C99-style anonymous arrays, so the pattern must be declared outside of the match call.
* glsl: new glsl_strtod() wrapper to fix decimal point interpretationBrian Paul2010-12-141-1/+1
| | | | | | | | 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.
* glsl: Don't print a useless space at the end of an S-Expression list.Kenneth Graunke2010-11-031-1/+2
| | | | | | We really only want to print spaces -between- elements, not after each element. This cleans up error messages from IR reader, making them (mildly) easier to read.
* glsl: Replace sscanf in s_expression reader with strspn and strcspn.Kenneth Graunke2010-08-181-20/+29
| | | | This seems to give roughly a 20% speedup.
* glsl2: Move the compiler to the subdirectory it will live in in Mesa.Eric Anholt2010-06-241-0/+131