summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Eliminate ir_variable::data.atomic.buffer_indexIan Romanick2014-08-293-4/+5
| | | | | | | | | | | | | | | | | | | Just use ir_variable::data.binding... because that's the where the binding is stored for everything else that can use layout(binding=). Valgrind massif results for a trimmed apitrace of dota2: n time(i) total(B) useful-heap(B) extra-heap(B) stacks(B) Before (32-bit): 50 40,564,927,443 69,185,408 63,683,871 5,501,537 0 After (32-bit): 74 40,580,119,657 69,186,544 63,506,327 5,680,217 0 Before (64-bit): 59 36,822,048,449 96,526,888 89,113,000 7,413,888 0 After (64-bit): 89 36,822,971,897 96,526,616 88,735,296 7,791,320 0 A real savings of 173KiB on 32-bit and 368KiB on 64-bit. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Add strings.h on non-MSC platformsAlexander von Gluck IV2014-08-271-0/+3
| | | | | | | | | | | | * IEEE Std 1003.1-2001 placed strcasecmp() in strings.h. * ISO C99 doesn't mention strcase* in string.h * On all platforms I could find, strcasecmp is in strings.h and string.h as a compatibility layer for software written pre-2001 POSIX * Technically strcasecmp should be only in strings.h and the man pages back this up. * Tested build on CentOS and Haiku Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Remove bogus "OUPTUT" tokenChris Forbes2014-08-261-1/+1
| | | | | | | | This is never used. There is another token "OUTPUT" which the lexer can generate, though. This has been around since the dawn of time; is most likely a typo. Signed-off-by: Chris Forbes <[email protected]>
* glcpp: Don't use alternation in the lookahead for empty pragmas.Carl Worth2014-08-221-2/+8
| | | | | | | | | | | | | | | | | | | | We've found that there's a buffer overrun bug in flex that's triggered by using alternation in a lookahead pattern. Fortunately, we don't need to match the exact {NEWLINE} expression to detect an empty pragma. It suffices to verify that there are no non-space characters before any newline character. So we can use a simple [\r\n] to get the desired behavior while avoiding the flex bug. Fixes the regression of piglit's 17000-consecutive-chars-identifier test, (which has been crashing since commit 04e40fd337a244ee77ef9553985e9398ff0344af ). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82472 Signed-off-by: Carl Worth <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> CC: <[email protected]>
* glsl/linker: pass through the is_intrinsic flagConnor Abbott2014-08-211-0/+2
| | | | | | | | | | | | This flag was set to true for the atomic counter intrinsics, but it never got plumbed through the linker, so by the time it got to the backends it would always be set to the false. The current i965 backend code doesn't use is_intrinsic, so this should not change any existing code, but it's useful for codepaths that want to distinguish between intrinsics and non-intrinsics without using strcmp. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Connor Abbott <[email protected]>
* glcpp: Fix glcpp-test-cr-lf "make check" test for Mac OS XCarl Worth2014-08-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | There were two problems with the way this script used sed on OS X: 1. The OS X sed doesn't interpret "\r" in a replacement list as a carriage-return character, (instead it was inserting a literal 'r' character). We fix this by putting an actual ^M character into the source of the script, (rather than a two-character escape sequence hoping for sed to do the right thing). 2. When generating the test files with LF-CR ("\n\r") newlines, the OS X sed was adding an undesired final newline ("\n") at the end of the file. We avoid this by first using sed to add the ^M before the newlines, then using tr to swap the \r and \n characters. This way, sed never sees any lines ending with anything but \n, so it doesn't get confused and doesn't add any bogus extra newlines. Tested-by: Vinson Lee <[email protected]> Vinson's testing confirmed that this patch fixes FreeBSD as well.
* glcpp: Use printf instead of "echo -n" in glcpp-testCarl Worth2014-08-201-2/+2
| | | | | | | | | | I noticed that with /bin/sh on Mac OS X, "echo -n" does not work as desired, (it actually prints "-n" rather than suppressing the final newline). There is a /bin/echo that could be used (it actually works) instead of the builtin echo. But I decided it's more robust to just use printf rather than hardcoding /bin/echo into the script.
* glsl: Use the without_array predicate in some more placesTimothy Arceri2014-08-191-2/+1
| | | | | Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Timothy Arceri <[email protected]>
* glsl: Use UniformBooleanTrue value for uniform initializers.Matt Turner2014-08-188-34/+52
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* glsl: Mark program as using dFdy if coarse/fine variant is usedChris Forbes2014-08-151-1/+3
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: add ARB_derivative control supportIlia Mirkin2014-08-148-0/+74
| | | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fixed vectorize pass vs. texture lookups.Aras Pranckevicius2014-08-141-0/+13
| | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82574 Reviewed-by: Matt Turner <[email protected]>
* android: glsl: the stlport over the limited Android STLEmil Velikov2014-08-131-1/+1
| | | | | | | The latter lacks various functionality used by mesa/glsl. Cc: "10.1 10.2" <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* glsl: Allow dynamically uniform sampler array indexing with 4.0/gs5Chris Forbes2014-08-121-1/+8
| | | | | | | | | V2: Expand comment to explain what dynamically uniform expressions are about. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: move ShaderCompilerOptions into gl_constantsMarek Olšák2014-08-115-6/+6
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl/glcpp: Rename one test to avoid a duplicate test numberCarl Worth2014-08-072-0/+0
| | | | | | | | | | | With two tests both numbered 118, there was a confusing off-by-two difference between the last test number and the total number of tests (as reported by glcpp-test). With this rename, there's only an off-by-one difference left, (which is easy to understand given the zero-based test numbering). Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Fix handling of commas that result from macro expansionCarl Worth2014-08-073-12/+45
| | | | | | | | | | | | | | | | | | | | | | | | Here is some additional stress testing of nested macros where the expansion of macros involves commas, (and whether those commas are interpreted as argument separators or not in subsequent function-like macro calls). Credit to the GCC documentation that directed my attention toward this issue: https://gcc.gnu.org/onlinedocs/gcc-3.2/cpp/Argument-Prescan.html Fixing the bug required only removing code from glcpp. When first testing the details of expansions involving commas, I had come to the mistaken conclusion that an expanded comma should never be treated as an argument separator, (so had introduced the rather ugly COMMA_FINAL token to represent this). In fact, an expanded comma should be treated as a separator, (as tested here), and this treatment can be avoided by judicious use of parentheses (as also tested here). With this simple removal of the COMMA_FINAL token, the behavior of glcpp matches that of gcc's preprocessor for all of these hairy cases. Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Integrate recent glcpp-test-cr-lf test into "make check"Carl Worth2014-08-074-13/+42
| | | | | | | | | | | | Beyond just listing this in the TESTS variable in Makefile.am, only minor changes were needed to make this work. The primary issue is that the build system runs the test script from a different directory than the script itself. So we have to use the $srcdir variable to find the test input files. Using $srcdir in this way also ensures that this test works when using an out-of-tree build. Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Fix glcpp-test to correctly extract test-specific argumentsCarl Worth2014-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | The (optional) test-specific command-line arguments to be passed to glcpp are embedded within the source files of some tests, and glcpp-test uses grep to extract them. Of course, grep is line-based and looks for the native line-separator to determine line boundaries. So, for files using non-native line separators, grep was getting quite confused and passing bogus arguments to glcpp. Fix this by canonical-izing the line separators in the source file prior to using grep. With this commit, the glcpp-test-cr-lf tests pass entirely: \r: 143/143 tests pass \r\n: 143/143 tests pass \n\r: 143/143 tests pass Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Fix line-continuation code to handle multiple newline flavorsCarl Worth2014-08-071-9/+87
| | | | | | | | | | | | | | | | | | | | | | | | | Sometimes the newline separator is a single character, and sometimes it is two characters. Before we can fold away and line-continuation backslashes, we identify the flavor of line separator that is in use. With this identified, we then correctly search for backslashes followed immediately by the first character of the line separator. Also, when re-inserting newlines to replace collapsed newlines, we carefully insert newlines of the same flavor. With this commit, almost all remaining test are fixed as tested by glcpp-test-cr-lf: \r: 142/143 tests pass \r\n: 142/143 tests pass \n\r: 143/143 tests pass (The only remaining failures have nothing to do with the actual pre-processor code, but are due to a bug in the way the test suite uses grep to try to extract test-specific command-line options from the source files.) Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Don't include any newline characters in #error tokenCarl Worth2014-08-071-1/+1
| | | | | | | | | | | | | | | | | | Some tests were failing because the message printed by #error was including a '\r' character from the source file in its output. This is easily avoided by fixing the regular expression for #error to never include any of the possible newline characters, (neither '\r' nor '\n'). With this commit 2 tests are fixed for each of the '\r' and '\r\n' cases. Current results after the commit are: \r: 137/143 tests pass \r\n 142/143 tests pass \n\r: 139/143 tests pass Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Treat CR+LF pair as a single newlineCarl Worth2014-08-072-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GLSL specification says that either carriage-return, line-feed, or both together can be used to terminate lines. Further, it says that when used together, the pair of terminators shall be interpreted as a single line. This final requirement has not been respected by glcpp up until now, (it has been emitting two newlines for every CR+LF pair). Here, we fix the lexer by using a regular expression for NEWLINE that eats up both "\r\n" (or even "\n\r") if possible before also considering a single '\n' or a single '\r' as a line terminator. Before this commit, the test results are as follows: \r: 135/143 tests pass \r\n: 4/143 tests pass \n\r: 4/143 tests pass After this commit, the test results are as follows: \r: 135/143 tests pass \r\n: 140/143 tests pass \n\r: 139/143 tests pass So, obviously, a dramatic improvement. Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Add test script for testing various line-termination charactersCarl Worth2014-08-072-11/+137
| | | | | | | | | | | | | | | | | | | | | | The GLSL specification has a very broad definition of what is a newline. Namely, it can be the carriage-return character, '\r', the newline character, '\n', or any combination of the two, (though in combination, the two are treated as a single newline). Here, we add a new test-runner, glcpp-test-cr-lf, that, for each possible line-termination combination, runs through the existing test suite with all source files modified to use those line-termination characters. Instead of using the .expected files for this, this script assumes that the regular test suite has been run already and expects the output to match the .out files. This avoids getting 4 test failures for any one bug, and instead will hopefully only report bugs actually related to the line-termination characters. The new testing is not yet integrated into "make check". For that, some munging of the testdir option will be necessary, (to support "make check" with out-of-tree builds). For now, the scripts can just be run directly by hand. Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Fix for macros that expand to include "defined" operatorsCarl Worth2014-08-073-45/+387
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this commit, the following snippet would trigger an error in glcpp: #define FOO defined BAR #if FOO #endif The problem was that support for the "defined" operator was implemented within the grammar, (where the parser was parsing the tokens of the condition itself). But what is required is to interpret the "defined" operator that results after macro expansion is performed. I could not find any fix for this case by modifying the grammar alone. The difficulty is that outside of the grammar we already have a recursive function that performs macro expansion (_glcpp_parser_expand_token_list) and that function itself must be augmented to be made aware of the semantics of the "defined" operator. The reason we can't simply handle "defined" outside of the recursive expansion function is that not only must we scan for any "defined" operators in the original condition (before any macro expansion occurs); but at each level of the recursive expansion, we must again scan the list of tokens resulting from expansion and handle "defined" before entering the next level of recursion to further expand macros. And of course, all of this is context dependent. The evaluation of "defined" operators must only happen when we are handling preprocessor conditionals, (#if and #elif) and not when performing any other expansion, (such as in the main body). To implement this, we add a new "mode" parameter to all of the expansion functions to specify whether resulting DEFINED tokens should be evaluated or ignored. One side benefit of this change is that an ugly wart in the grammar is removed. We previously had "conditional_token" and "conditional_tokens" productions that were basically copies of "pp_token" and "pp_tokens" but with added productions for the various forms of DEFINED operators. With the new code here, those ugly copy-and-paste productions are eliminated from the grammar. A new "make check" test is added to stress-test the code here. This commit fixes the following Khronos GLES3 CTS tests: conditional_inclusion.basic_2_vertex conditional_inclusion.basic_2_fragment Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Swallow empty #pragma directives.Carl Worth2014-08-072-1/+7
| | | | | | | | | | | | | | Previously, we were passing these through, just like any other pragma. But the downstream compiler was tripping up on them. It seems easier to swallow these in the preprocessor and not pass them on at all rather than fixing the downstream compiler. This fixes the following Khronos GLES3 CTS tests: preprocessor.pragmas.pragma_vertex preprocessor.pragmas.pragma_fragment Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Fix #pragma to not over-increment the line-number countCarl Worth2014-08-073-2/+12
| | | | | | | | | | | | | | Previously, the #pragma directive was swallowing an entire line, (including the final newline). At that time it was appropriate for it to increment the line count. More recently, our handling of #pragma changed to not include the newline. But the code to increment yylineno stuck around. This was causing __LINE__ to be increased by one more than desired for every #pragma. Remove the bogus, extra increment, and add a test for this case. Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Add testing for null directives with spaces and commentsCarl Worth2014-08-072-0/+18
| | | | | | | | This new "make check" test stresses out the support from the last two commits, (to esnure that '#' is correctly interpreted as the null directives, regardless of any whitespace or comments on the same line). Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Fix NULL directives when followed by a single-line commentCarl Worth2014-08-071-1/+1
| | | | | | | | | | | | | | | | | | | This is the fix for the following line: # // comment to ignore here According to the translation-phase rules, the comment should be removed before the preprocessor looks to interpret the null directive. So in our implementation we must explicitly look for single-line comments in the <HASH> start condition as well. This commit fixes the following Khronos GLES3 CTS tests: null_directive_vertex null_directive_fragment Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Add tests for #define followed by commentsCarl Worth2014-08-072-2/+8
| | | | | | | This simply tests the previous commit, (that #define followed by a comment will still generate the expected "#define without macro name" error message). Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Allow single-line comments immediately after #defineCarl Worth2014-08-071-1/+1
| | | | | | | | | | | | | | | | We were already correctly supporting single-line comments in case like: #define FOO bar // comment here... The new support added here is simply for the none-too-useful: #define // comment instead of macro name With this commit, this line will now give the expected "#define without macro name" error message instead of the lexer just going off into the weeds. Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Add test for "#define without macro name"Carl Worth2014-08-072-0/+4
| | | | | | | | This ensures that the previous commit indeed generates the expected error message when a "#define" directive is not followed by anything except for a newline. Reviewed-by: Ian Romanick <[email protected]>
* glsl/glcpp: Add explicit error for "#define without macro name"Carl Worth2014-08-073-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | Previously, glcpp would emit an error like this if <EOF> happened to occur immediately after the "#define", but in general would just get confused, (leading to un-helpful error messages). To fix things to generate a clean error message, we do a few things: 1. Don't require horizontal whitespace immediately after #define 2. Add a production for the error case, (DEFINE_TOKEN followed immediately by a NEWLINE token). 3. Make the lexer reset to the <INITIAL> state after every NEWLINE. This 3rd point prevents the lexer from getting so confused and generating further spurious errors in the file because it was stuck in the <DEFINE> start condition. We also drop the similar error message from the <EOF> rule since the newly-added rule will have already printed the error message. Reviewed-by: Ian Romanick <[email protected]>
* glsl: support unsigned increment in ir_loop controlsTapani Pälli2014-08-071-3/+14
| | | | | | | | | | Current version can create ir_expression where operands have different base type, patch adds support for unsigned type. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Michel Dänzer <[email protected]> https://bugs.freedesktop.org/show_bug.cgi?id=80880
* glsl: Rebuild the symbol table without unreachable symbolsIan Romanick2014-08-041-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we had to keep unreachable global symbols in the symbol table because the symbol table is used during linking. Having the symbol table retain pointers to freed memory... what could possibly go wrong? At the same time, this meant that we kept live references to tons of memory that was no longer needed. New strategy: destroy the old symbol table, and make a new one from the reachable symbols. Valgrind massif results for a trimmed apitrace of dota2: n time(i) total(B) useful-heap(B) extra-heap(B) stacks(B) Before (32-bit): 59 40,642,425,451 76,337,968 69,720,886 6,617,082 0 After (32-bit): 46 40,661,487,174 75,116,800 68,854,065 6,262,735 0 Before (64-bit): 79 37,179,441,771 106,986,512 98,112,095 8,874,417 0 After (64-bit): 64 37,200,329,700 104,872,672 96,514,546 8,358,126 0 A real savings of 846KiB on 32-bit and 1.5MiB on 64-bit. v2: (by Kenneth Graunke) Just add the ir_function from the IR stream, rather than looking it up in the symbol table; they're now identical. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Only create one ir_function for a given name.Kenneth Graunke2014-08-041-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Piglit's spec/glsl-1.10/linker/override-builtin-{const,uniform}-05 tests do the following: 1. Call abs(float) - a built-in function. 2. Create a user-defined replacement for abs(float). 3. Call abs(float) again - now the user function. At step 1, we created an ir_function which included the built-in signature, added it to the symbol table, and emitted it into the IR stream. Then, when processing the function definition at step 2, we'd see that there was already an ir_function. But, since there were no user-defined functions, we skipped over a bunch of code, and ended up creating a second one. This new ir_function shadowed the original in the symbol table, but both ended up in the IR stream. This results in an awkward situation where searching for an ir_function via the symbol table, a forward linked list walk, and a reverse linked list walk may return different ir_functions. This seems undesirable. This patch instead re-uses the existing ir_function, putting both built-in and user-defined signatures in the same one. The previous patch's additional filtering ensures everything continues working. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Make it possible to ignore built-ins when matching signatures.Kenneth Graunke2014-08-048-16/+26
| | | | | | | | | | | | | | | | | | Historically, we've implemented the rules for overriding built-in functions by creating multiple ir_functions and relying on the symbol table to hide the one containing built-in functions. That works, but has a few drawbacks, so the next patch will change it. Instead, we'll have a single ir_function for a particular name, which will contain both built-in and user-defined signatures. Passing an extra parameter to matching_signature makes it easy to ignore built-ins when they're supposed to be hidden. I didn't add the parameter to exact_matching_signature since it wasn't necessary. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Do not add extra padding to structuresIan Romanick2014-08-041-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This code was attemping to align the base of the structure to the required alignment of the structure. However, it had two problems: 1. It was aligning the target structure member, not the base of the structure. 2. It was calculating the alignment based on the members previous to the target member instead of all the members of the structure. Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.nested_structs.6 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.2 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.6 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.5 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.19 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.0 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.2 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.6 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.12 v2: Fix rebase failure noticed by Matt. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Correctly determine when the field of a UBO is row-majorIan Romanick2014-08-041-15/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously if a field of an block with an instance name was marked row-major (but block itself was not), we would think the field (and it's sub-fields) were column-major. Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.basic_types.7 ES3-CTS.shaders.uniform_block.random.basic_types.9 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.1 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.3 ES3-CTS.shaders.uniform_block.random.nested_structs.3 ES3-CTS.shaders.uniform_block.random.nested_structs.5 ES3-CTS.shaders.uniform_block.random.nested_structs.8 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.3 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.6 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.7 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.8 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.9 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.0 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.1 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.2 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.3 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.4 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.6 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.0 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.1 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.5 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.0 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.4 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.7 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.8 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.12 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.14 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.15 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.16 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.1 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.8 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.9 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.10 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.11 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.13 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.14 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.15 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.16 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.17 Fixes gles3conform failures (caused by previous commits) in: ES3-CTS.shaders.uniform_block.random.basic_types.8 ES3-CTS.shaders.uniform_block.random.basic_arrays.3 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.0 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.2 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.9 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.13 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.18 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.4 v2: Fix rebase failure noticed by Matt. v3: Use without_array() instead of older predicates. v4: s/GLSL_MATRIX_LAYOUT_DEFAULT/GLSL_MATRIX_LAYOUT_INHERITED/g Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> [v2]
* linker: Use the matrix layout information in ir_variable and glsl_type for ↵Ian Romanick2014-08-041-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UBO layout Use the data that is stored in the ir_variable and the glsl_type to determine whether or not a UBO member is row-major. Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat2x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat3x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.shared.row_major_mat4x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat2x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat3x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.packed.row_major_mat4x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2x3 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat2x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat3x4 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4x2 ES3-CTS.shaders.uniform_block.instance_array_basic_type.std140.row_major_mat4x3 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.2 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.5 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.9 Causes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.basic_types.8 ES3-CTS.shaders.uniform_block.random.basic_arrays.3 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.0 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.2 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.13 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.18 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.4 These failures will be fixed shortly. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Track matrix layout of variables using two bitsIan Romanick2014-08-044-15/+61
| | | | | | | | | | | | | | | | | | | | Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.3 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.13 Causes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.9 This failure will be fixed shortly. v2: Use without_array() instead of older predicates. v3: s/GLSL_MATRIX_LAYOUT_DEFAULT/GLSL_MATRIX_LAYOUT_INHERITED/g Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> [v1]
* glsl: Also track matrix layout information into structuresIan Romanick2014-08-041-1/+7
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Track matrix layout of structure fields using two bitsIan Romanick2014-08-046-50/+96
| | | | | | | | | v2: Rename GLSL_MATRIX_LAYOUT_DEFAULT to GLSL_MATRIX_LAYOUT_INHERITED. Add comments in glsl_types.h explaining the layouts. Suggested by Matt. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Correctly load columns of a row-major matrixIan Romanick2014-08-041-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a row-major matrix, the next column starts at the next element. Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat2 ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat3 ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat4 ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat2x3 ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat2x4 ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat3x2 ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat3x4 ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat4x2 ES3-CTS.shaders.uniform_block.single_basic_array.shared.row_major_mat4x3 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat2 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat3 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat4 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat2x3 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat2x4 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat3x2 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat3x4 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat4x2 ES3-CTS.shaders.uniform_block.single_basic_array.packed.row_major_mat4x3 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat2 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat3 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat4 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat2x3 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat2x4 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat3x2 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat3x4 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat4x2 ES3-CTS.shaders.uniform_block.single_basic_array.std140.row_major_mat4x3 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.9 Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* linker: Add padding after the last field of a structureIan Romanick2014-08-043-3/+25
| | | | | | | | | | | | This causes the thing following the structure to be vec4-aligned. Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.random.nested_structs.2 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.5 Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* linker: Add a last_field parameter to various program_resource_visitor methodsIan Romanick2014-08-043-16/+30
| | | | | | | | | I also considered renaming visit_field(const glsl_struct_field *) to entry_record and adding an exit_record method. This would be more similar to the hierarchical visitor. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Do not eliminate 'shared' or 'std140' blocks or block membersIan Romanick2014-08-043-4/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 32f32292 (glsl: Allow elimination of uniform block members) enabled elimination of unused uniform block members to fix a gles3 conformance test failure. This went too far the other way. Section 2.11.6 (Uniform Variables) of the OpenGL ES 3.0.3 spec says: "All members of a named uniform block declared with a shared or std140 layout qualifier are considered active, even if they are not referenced in any shader in the program. The uniform block itself is also considered active, even if no member of the block is referenced." Fixes gles3conform failures in: ES3-CTS.shaders.uniform_block.single_nested_struct.per_block_buffer_shared ES3-CTS.shaders.uniform_block.single_nested_struct.per_block_buffer_std140 ES3-CTS.shaders.uniform_block.single_nested_struct_array.per_block_buffer_shared ES3-CTS.shaders.uniform_block.single_nested_struct_array.per_block_buffer_std140 ES3-CTS.shaders.uniform_block.random.scalar_types.2 ES3-CTS.shaders.uniform_block.random.scalar_types.9 ES3-CTS.shaders.uniform_block.random.vector_types.1 ES3-CTS.shaders.uniform_block.random.vector_types.3 ES3-CTS.shaders.uniform_block.random.vector_types.7 ES3-CTS.shaders.uniform_block.random.vector_types.9 ES3-CTS.shaders.uniform_block.random.basic_types.5 ES3-CTS.shaders.uniform_block.random.basic_types.6 ES3-CTS.shaders.uniform_block.random.basic_arrays.0 ES3-CTS.shaders.uniform_block.random.basic_arrays.2 ES3-CTS.shaders.uniform_block.random.basic_arrays.5 ES3-CTS.shaders.uniform_block.random.basic_arrays.8 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.0 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.4 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.5 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.6 ES3-CTS.shaders.uniform_block.random.basic_instance_arrays.9 ES3-CTS.shaders.uniform_block.random.nested_structs.0 ES3-CTS.shaders.uniform_block.random.nested_structs.1 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays.4 ES3-CTS.shaders.uniform_block.random.nested_structs_instance_arrays.8 ES3-CTS.shaders.uniform_block.random.nested_structs_arrays_instance_arrays.7 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.3 ES3-CTS.shaders.uniform_block.random.all_per_block_buffers.6 ES3-CTS.shaders.uniform_block.random.all_shared_buffer.18 v2: Whitespace and other minor fixes suggested by Matt. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Use the without_array predicate to simplify some codeIan Romanick2014-08-044-23/+12
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> [v1] Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Add without_array type predicateIan Romanick2014-08-041-0/+12
| | | | | | | | | | | Returns the type without any arrays. This will be used in later patches in this series. Signed-off-by: Ian Romanick <[email protected]> Suggested-by: Timothy Arceri <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Use constant_expression_value instead of as_constantIan Romanick2014-08-041-1/+2
| | | | | | | | | Just a few lines earlier we may have wrapped the index expression with ir_unop_i2u expression. Whenever that happens, as_constant will return NULL, and that almost always happens. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* util: Gather some common macrosJason Ekstrand2014-08-041-3/+4
| | | | | | | | | | This gathers macros that have been included across components into util so that the include chain can be more vertical. In particular, this makes util stand on its own without any dependence whatsoever on the rest of mesa. Signed-off-by: "Jason Ekstrand" <[email protected]> Reviewed-by: Marek Olšák <[email protected]>