summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Implement ARB_texture_query_lodDave Airlie2013-03-291-0/+3
| | | | | | | | | | | | | | | | | | | v2 [mattst88]: - Rebase. - #define GL_ARB_texture_query_lod to 1. - Remove comma after ir_lod in ir.h for MSVC. - Handled ir_lod in ir_hv_accept.cpp, ir_rvalue_visitor.cpp, opt_tree_grafting.cpp. - Rename textureQueryLOD to textureQueryLod, see https://www.khronos.org/bugzilla/show_bug.cgi?id=821 - Fix ir_reader of (lod ...). v3 [mattst88]: - Rename textureQueryLod to textureQueryLOD, pending resolution of Khronos 821. - Add ir_lod case to ir_to_mesa.cpp. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add support for ARB_texture_multisampleChris Forbes2013-03-021-0/+3
| | | | | | | | | | | | | | | | | | V2: - emit `sample` parameter properly for multisample texelFetch() - fix spurious whitespace change - introduce a new opcode ir_txf_ms rather than overloading the existing ir_txf further. This makes doing the right thing in the driver somewhat simpler. V3: - fix weird whitespace V4: - don't forget to include the new opcode in tex_opcode_strs[] (thanks Kenneth for spotting this) Signed-off-by: Chris Forbes <[email protected]> [V2] Reviewed-by: Eric Anholt <[email protected]> [V2] Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Add infrastructure for ARB_shading_language_packingMatt Turner2013-01-251-0/+3
| | | | | Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl/build: Build glcpp via the glsl MakefileMatt Turner2013-01-222-56/+2
| | | | | | Removing the subdirectory recursion provides a small speed up. Tested-by: Andreas Boll <[email protected]>
* glsl/build: Remove dead LIBRARY_* variablesMatt Turner2013-01-201-2/+0
| | | | Reviewed-by: Andreas Boll <[email protected]>
* glcpp: Add tests for line continuationCarl Worth2013-01-114-0/+46
| | | | | | | | | First we test that line continuations are honored within a comment, (as recently changed in glcpp), then we test that line continuations can be disabled via an option within the context. This is tested via the new support for a test-specific command-line option passed to glcpp. Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Rewrite line-continuation support to act globally.Carl Worth2013-01-111-66/+49
| | | | | | | | | | | | | | | | | | | Previously, we were only supporting line-continuation backslash characters within lines of pre-processor directives, (as per the specification). With OpenGL 4.2 and GLES3, line continuations are now supported anywhere within a shader. While changing this, also fix a bug where the preprocessor was ignoring line continuation characters when a line ended in multiple backslash characters. The new code is also more efficient than the old. Previously, we would perform a ralloc copy at each newline. We now perform copies only at each occurrence of a line-continuation. This commit fixes the line-continuation.vert test in piglit. Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Add --disable-line-continuations argument to standalone glcppCarl Worth2013-01-111-2/+44
| | | | | | | This will allow testing of disabled line-continuation on a case-by-case basis, (with the option communicated to the preprocessor via the GL context). Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Allow test-specific arguments for standalone glcpp testsCarl Worth2013-01-111-2/+9
| | | | | | | | This will allow the test exercising disabled line continuations to arrange for the --disable-line-continuations argument to be passed to the standalone glcpp. Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Honor the GL context's DisableGLSLLineContinuations optionCarl Worth2013-01-111-1/+3
| | | | | | And simply don't call into the function that removes line continuations. Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Accept pointer to GL context rather than just the API versionCarl Worth2013-01-113-4/+17
| | | | | | | | | As the preprocessor becomes more sophisticated and gains more optional behavior, it's easiest to just pass the GL context pointer to it so that it can examine any fields there that it needs to (such as API version, or the state of any driconf options, etc.). Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Reject token pasting operator in GLESMatt Turner2013-01-111-0/+2
| | | | | | | | | The GLSL ES 3.0 spec (Section 12.17) says: "GLSL ES 1.00 removed token pasting and other functionality." NOTE: This is a candidate for the stable branches. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Carl Worth <[email protected]>
* glcpp: Make undefined macros illegal in #if and #elif for GLES3Carl Worth2013-01-111-0/+2
| | | | | | | | | | | | Simply emitting a nicely-formatted error message if any undefined macro is encountered in a parser context expecting an expression. With this commit, the following piglit test now passes: spec/glsl-es-3.00/compiler/undefined-macro.vert Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glcpp: Add a flag to the parser state to indicate GLES.Carl Worth2013-01-112-11/+16
| | | | | | | | | | | | This can be triggered either by creation of a GLES context (with api == API_OPENGLES2) or else by a #version directive with version value 100 or with a string of "es" following the version value. There's no behavioral change with this commit—just preparation for ES-specific behavior in the preprocessor in the future. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glcpp: Add back tests/*.out to .gitignoreAndreas Boll2013-01-111-0/+1
| | | | Accidentally removed in ac2793cf3e1e004942c386dfa45f3b5507223f50
* Clean up .gitignore filesMatt Turner2013-01-101-2/+0
|
* glcpp: Typo fix.Adam Jackson2013-01-021-1/+1
| | | | | | Note: this is a candidate for the 9.0 stable branch. Signed-off-by: Adam Jackson <[email protected]>
* glcpp: Fix visibility CFLAGS in automakeAdam Jackson2013-01-021-0/+1
| | | | | | Note: this is a candidate for the 9.0 stable branch. Signed-off-by: Adam Jackson <[email protected]>
* program/hash_table.c: rename to program/prog_hash_table.cJordan Justen2012-12-071-1/+1
| | | | | | | | Removes a collision of the object file name for main/hash_table and program/hash_table. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl/preprocessor: Handle "#version 300 es" directive.Paul Berry2012-12-061-4/+17
| | | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Carl Worth <[email protected]>
* glsl/preprocessor: Extract version directive processing into a function.Paul Berry2012-12-061-19/+30
| | | | | | | | | | | | | | | | | | | | | Version directive handling is going to have to be used within two parser rules, one for desktop-style version directives (e.g. "#version 130") and one for the new ES-style version directive (e.g. "#version 300 es"), so this patch moves it to a function that can be called from both rules. No functional change. [mattst88] v2: Use intmax_t instead of int for version argument. Would otherwise write garbage after #version since PRIiMAX was reading 64-bits instead of 32. [idr] v3: A later commit fixes the caller of _glcpp_parser_handle_version_declaration to pass the correct number of parameters. Fix it in the patch that changes the interface instead. Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Carl Worth <[email protected]>
* Revert "glcpp: Rewrite line-continuation support to act globally."Carl Worth2012-11-301-43/+66
| | | | | | | | This reverts commit 962a1c07b44fe500b79b3ca6806d72a432c1f055. Further testing revealed that this commit can cause the pre-processor to enter infinite loops. For now, simply revert this code until a cleaner, better-tested version is available.
* glcpp: Rewrite line-continuation support to act globally.Carl Worth2012-11-301-66/+43
| | | | | | | | | | | | | | | | | Previously, we were only supporting line-continuation backslash characters within lines of pre-processor directives, (as per the specification). With OpenGL 4.2 and GLES3, line continuations are now supported anywhere within a shader. While changing this, also fix a bug where the preprocessor was ignoring line continuation characters when a line ended in multiple backslash characters. The new code is also more efficient than the old. Previously, we would perform a ralloc copy at each newline. We now perform copies only at each occurrence of a line-continuation. Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Update README for new support of __LINE__ and __FILE__.Carl Worth2012-11-291-3/+1
| | | | | | | | | Drop these from the known limitations list since support was recently added for these. Also, fix a typo while in the area, (and the oddly missing final newline). Reviewed-by: Matt Turner <[email protected]>
* glcpp: Add test involving token pasting of INTEGER tokens.Carl Worth2012-11-292-0/+15
| | | | | | | | | | | | | | | This test file is very similar to test 113-line-and-file-macros but uses token pasting for cleaner quiz answers (without spaces between the digits). This test passes thanks to the recent addition of support for pasting INTEGER tokens, (but would have failed without that). (Note that this test is distinct from test 059-token-pasting-integer which pastes integers parsed from the source. Those are parsed to INTEGER_STRING tokens and are already pasted correctly as verified by that test. The only way to generate the INTEGER tokens which currently fail to paste is with an internal define such as __LINE__ that results in an integer.) Reviewed-by: Matt Turner <[email protected]>
* glcpp: Add support for pasting of INTEGER tokens.Carl Worth2012-11-291-14/+47
| | | | | | | By generalizing the current code designed to paste string tokens of various types. Reviewed-by: Matt Turner <[email protected]>
* glcpp: Flag invalid pastes for integer followed by non-digitsCarl Worth2012-11-291-5/+13
| | | | | | | | | As recently tested in the additions to the invalid paste test, it is illegal to paste a non-digit sequence onto the end of an integer. The 082-invalid-paste test should now pass again. Reviewed-by: Matt Turner <[email protected]>
* glcpp: Extend the invalid-paste testCarl Worth2012-11-292-0/+20
| | | | | | | | The current code lets a few invalid pastes through, such as an string pasted onto the end of an integer. Extend the invalid-paste test to catch some of these. Reviewed-by: Matt Turner <[email protected]>
* glcpp: More factoring-out of common code to simplify things.Carl Worth2012-11-291-26/+20
| | | | | | | | This time creating a new _token_list_create_with_one_integer function modeled after the existing _token_list_create_with_one_space function (both implemented with new _token_list_create_with_one_ival). Reviewed-by: Matt Turner <[email protected]>
* glcpp: Factor out a tiny bit of repeated code.Carl Worth2012-11-291-4/+1
| | | | | | | This function is getting a little long too read. Simplify it by pulling up one assignment from every condition. Reviewed-by: Matt Turner <[email protected]>
* glcpp: Add support for __LINE__ and __FILE__ macrosCarl Worth2012-11-293-1/+45
| | | | | | | | | | | | | These tokens are easy to expand by just looking at the current, tracked location values, (and no need to look anything up in the hash table). Add a test which verifies __LINE__ with several values, (and verifies __FILE__ for the single value of 0). Our testing framework isn't sophisticated enough here to have a test with multiple file inputs. This commit fixes part of es3conform's preprocess16_frag test. Reviewed-by: Matt Turner <[email protected]>
* mesa: Rename API_OPENGL to API_OPENGL_COMPAT.Paul Berry2012-11-291-1/+1
| | | | | | | | | | This should help avoid confusion now that we're using the gl_api enum to distinguishing between core and compatibility API's. The corresponding enum value for core API's is API_OPENGL_CORE. Acked-by: Eric Anholt <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* glcpp: Support #elif(expression) with no intervening space.Matt Turner2012-11-287-1/+96
| | | | | | | | | | | | And add test cases to ensure that this works - 110 verifies that glcpp rejects #elif<digits> which glcpp previously accepted. - 111 verifies that glcpp accepts #if followed immediately by (, +, -, !, or ~. - 112 does the same as 111 but for #elif. See 17f9beb6 for #if change. Reviewed-by: Carl Worth <[email protected]>
* glcpp: Reject #version and #line not followed by whitespaceMatt Turner2012-11-285-2/+8
| | | | | Fixes part of es3conform's preprocess16_frag test. Reviewed-by: Carl Worth <[email protected]>
* glcpp: Don't define macros for extensions that aren't in ESMatt Turner2012-11-151-28/+31
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: wire up glcpp-test to make checkMatt Turner2012-11-092-4/+14
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp/tests: Add tests for multiline #elifMatt Turner2012-11-092-0/+15
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp/tests: Add test for multiline #ifMatt Turner2012-11-092-0/+13
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp/tests: Add test for multiline #lineMatt Turner2012-11-092-0/+11
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp/tests: Add test to check #line followed by codeMatt Turner2012-11-092-0/+5
| | | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51802 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51506 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41152 Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: don't push #line directives into next lineFabian Bieler2012-11-092-9/+9
| | | | | | | | | | | | | | By moving the HASH_LINE rule out of control_line: and into line:, we avoid adding control_line's additional \n (as seen in the first hunk). mattst88: Carl and I determined independently of Fabian that the 091 test needed to be modified identically to this, and our patch to fix the test was more complicated. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51506 Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Reject garbage after #else and #endif tokensMatt Turner2012-11-095-4/+15
| | | | | | | | | | | | | | | | | | | | | | Previously we were accepting garbage after #else and #endif tokens when the previous preprocessor conditional evaluated to false (eg, #if 0). When the preprocessor hits a false conditional, it switches the lexer into the SKIP state, in which it ignores non-control tokens. The parser pops the SKIP state off the stack when it reaches the associated #elif, #else, or #endif. Unfortunately, that meant that it only left the SKIP state after the lexing the entire line containing the #token and thus would accept garbage after the #token. To fix this we use a mid-rule, which is executed immediately after the #token is parsed. NOTE: This is a candidate for the stable branch Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56442 Fixes: preprocess17_frag.test from oglconform Reviewed-by: Carl Worth <[email protected]> (glcpp-parse.y) Acked-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add ARB_texture_cube_map_array support (v2)Dave Airlie2012-11-091-0/+3
| | | | | | | | | | | | This adds all the new builtins + the new sampler types, and hooks them up if the extension is supported. v2: fix missing signatures for grad/lod fix missing textureSize clarifications fix compare vs starts with usage Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glcpp: Don't use infinite lookhead for #define differentiation.Kenneth Graunke2012-10-252-12/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we used lookahead patterns to differentiate: #define FOO(x) function macro #define FOO (x) object macro Unfortunately, our rule for function macros: {HASH}define{HSPACE}+/{IDENTIFIER}"(" relies on infinite lookahead, and apparently triggers a Flex bug where the generated code overflows a state buffer (see YY_STATE_BUF_SIZE). There's no need to use infinite lookahead. We can simply change state, match the identifier, and use a single character lookahead for the '('. This apparently makes Flex not generate the giant state array, which avoids the buffer overflow, and should be more efficient anyway. Fixes piglit test 17000-consecutive-chars-identifier.frag. NOTE: This is a candidate for every release branch ever. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Carl Worth <[email protected]>
* mesa/glsl: rename preprocess to glcpp_preprocessDave Airlie2012-09-153-3/+3
| | | | | | | | | | This symbol with dricore escapes into the namespace, its too generic, we should prefix it with something just to be nice. Should be applied to stable + 9.0 Acked-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glcpp: fix abuse of yylexDave Airlie2012-09-152-9/+1
| | | | | | | | | | | | So glcpp tried to workaround yylex its own way, but failed, do it properly. This fixes another crash found after fixing the first crash. this is a candidate for 9.0 and stable branches Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* build/glsl: fix location of generated files.Christopher James Halse Rogers2012-08-131-4/+0
| | | | | | | | Like in src/mesa, use GLSL_BUILDDIR/GLSL_SRCDIR to unambiguously distinguish between in-tree and generated files. Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Christopher James Halse Rogers <[email protected]>
* glcpp: Add a newline to expanded #line directives.Kenneth Graunke2012-07-281-2/+2
| | | | | | | | | | | | | | | | | | | | Otherwise, the preprocessor happily outputs #line 2 4 <your next line of code> and the main compiler gets horribly confused and fails to compile. This is not the right solution (line numbers in error messages will likely be off-by-one in certain circumstances), but until Carl comes up with a proper fix, this gets programs running again. Fixes regressions in Regnum Online, Overgrowth, Piglit, and others since commit aac78ce8234d96932c38b3f48b1d828077bc0027. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51802 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51506 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41152 Signed-off-by: Kenneth Graunke <[email protected]>
* automake: convert libglslJon TURNEY2012-07-132-0/+58
| | | | | | | | | | | | | | | | | | | | v2: Use AM_V_GEN to silence generated code rules. Add BUILT_SOURCES to CLEANFILES v3: - Fix an accidental // in a path - Use automake make rules for lex/yacc rather than writing our own - Update .gitignore appropriately - Build a libglcpp convenience library rather than awkwardly including the files in libglsl and delegating the generation - Remove libglsl.a compatibility link on clean v4: - Automake's rules for lex/yacc make .cc if source is .ll or .yy, and apparently we must use those extensions "because of scons", so update everywhere glsl_parser.cpp -> glsl_parser.cc and glsl_lexer.cpp -> glsl_lexer.cc. This fixes 'make tarballs' and building with dricore enabled. Signed-off-by: Jon TURNEY <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Matt Turner <[email protected]>
* glcpp: Add built-in #define for GL_ARB_uniform_buffer_object.Kenneth Graunke2012-07-091-0/+3
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>