Kenneth Graunke [Mon, 16 Aug 2010 20:42:04 +0000 (13:42 -0700)]
glcpp: Remove spurious newline generated by #version handling.
This was causing line numbering to be off by one. The newline comes
from the NEWLINE token at the end of the line; there's no need to
insert one.
Ian Romanick [Mon, 16 Aug 2010 16:45:01 +0000 (09:45 -0700)]
ir_to_mesa: Silence unused variable warnings
Ian Romanick [Mon, 16 Aug 2010 16:43:00 +0000 (09:43 -0700)]
ir_to_mesa: Clean up assertions in ir_to_mesa_visitor::visit(ir_texture *)
Ian Romanick [Mon, 16 Aug 2010 16:39:58 +0000 (09:39 -0700)]
ir_to_mesa: Support texture rectangle targets
Marek Olšák [Sun, 15 Aug 2010 23:53:30 +0000 (01:53 +0200)]
st/mesa: remove output register reads inside shaders
This is a GLSL2 regression fix.
Vinson Lee [Sun, 15 Aug 2010 20:08:15 +0000 (13:08 -0700)]
mesa: Check that _XOPEN_SOURCE is defined before using it.
José Fonseca [Sat, 14 Aug 2010 15:01:24 +0000 (16:01 +0100)]
Revert "glsl2: Use stdint.h instead of inttypes.h"
This reverts commit
a77a6bc008b3146c56431fa520a00e1f8dfa3938.
José Fonseca [Sat, 14 Aug 2010 15:00:52 +0000 (16:00 +0100)]
Replace our custom C99 headers with code.google.com/p/msinttypes/
Perhaps http://www.azillionmonkeys.com/qed/pstdint.h would be a better
(more portable) choice, but only MSVC uses this anyway, and we can always
change later.
José Fonseca [Sat, 14 Aug 2010 14:35:57 +0000 (15:35 +0100)]
glsl: Standardize a few more uses of struct vs class keyword.
José Fonseca [Sat, 14 Aug 2010 14:29:15 +0000 (15:29 +0100)]
scons: Link talloc.
José Fonseca [Sat, 14 Aug 2010 13:40:39 +0000 (14:40 +0100)]
glsl: Silence gcc warning "control reaches end of non-void function".
José Fonseca [Sat, 14 Aug 2010 13:40:06 +0000 (14:40 +0100)]
mesa: Silence gcc warning "control reaches end of non-void function".
José Fonseca [Sat, 14 Aug 2010 13:38:09 +0000 (14:38 +0100)]
mesa: Silence gcc warning "missing initializer for member".
José Fonseca [Sat, 14 Aug 2010 12:10:24 +0000 (13:10 +0100)]
mesa: Recent versions of MSVC define the single precision functions already.
José Fonseca [Sat, 14 Aug 2010 11:45:14 +0000 (12:45 +0100)]
scons: Add new source files.
José Fonseca [Sat, 14 Aug 2010 11:43:56 +0000 (12:43 +0100)]
mesa: atan2f and powf need two args.
Ian Romanick [Sat, 14 Aug 2010 03:22:46 +0000 (20:22 -0700)]
Merge branch 'master' into glsl2
Ian Romanick [Sat, 14 Aug 2010 03:18:08 +0000 (20:18 -0700)]
mesa: Work-arounds for platforms that lack C99 math functions
Kenneth Graunke [Sat, 14 Aug 2010 00:46:25 +0000 (17:46 -0700)]
glsl2/Makefile: Add a 'make builtins' target.
This copies over a dummy builtin_functions.cpp and rebuilds a
bootstrapped version of the compiler, then uses that to generate the
proper list of builtins. Finally, it rebuilds the compiler with the new
list.
Unfortunately, it's no longer automatic, but at least it works.
Kenneth Graunke [Wed, 11 Aug 2010 23:53:52 +0000 (16:53 -0700)]
glsl2: Rework builtin function generation.
Each language version/extension and target now has a "profile" containing
all of the available builtin function prototypes. These are written in
GLSL, and come directly out of the GLSL spec (except for expanding genType).
A new builtins/ir/ folder contains the hand-written IR for each builtin,
regardless of what version includes it. Only those definitions that have
prototypes in the profile will be included.
The autogenerated IR for texture builtins is no longer written to disk,
so there's no longer any confusion as to what's hand-written or
generated.
All scripts are now in python instead of perl.
Kenneth Graunke [Thu, 12 Aug 2010 20:17:53 +0000 (13:17 -0700)]
ir_reader: Don't mark functions as defined if their body is empty.
Ian Romanick [Sat, 14 Aug 2010 02:05:54 +0000 (19:05 -0700)]
glsl2: Commit generated file change by commit
ab18be74
This would have been included in commit
23f6017d, but make wisely did
not regenerate the file when the .lpp file did not change.
Eric Anholt [Fri, 13 Aug 2010 14:16:38 +0000 (07:16 -0700)]
glsl2: Add a pass to strip out noop swizzles.
With the glsl2-965 branch, the optimization of glsl-algebraic-rcp-rcp
regressed due to noop swizzles hiding information from ir_algebraic.
This cleans up those noop swizzles for us.
Eric Anholt [Sat, 14 Aug 2010 03:50:10 +0000 (20:50 -0700)]
glsl2: Convert ir_constant_propagation to ir_rvalue_visitor.
This one is a little tricky because of the LHS handling.
Eric Anholt [Sat, 14 Aug 2010 03:39:24 +0000 (20:39 -0700)]
glsl2: Add a generic visitor class to call back with pointers to each rvalue.
I keep copy and pasting this code all over, so consolidate it in one
place.
Eric Anholt [Wed, 11 Aug 2010 05:33:39 +0000 (22:33 -0700)]
mesa: Avoid using c++ keyword in dri_util.h when compiled with c++.
Eric Anholt [Wed, 11 Aug 2010 05:21:59 +0000 (22:21 -0700)]
intel: Remove include of texmem.h, since we haven't used it in ages.
Eric Anholt [Wed, 11 Aug 2010 03:11:44 +0000 (20:11 -0700)]
glsl2: Move ir_to_mesa handling to driver CompileShader and LinkShader hooks.
This lets drivers override ir_to_mesa with their own codegen, or at
least have a native alternative.
Eric Anholt [Wed, 11 Aug 2010 02:52:02 +0000 (19:52 -0700)]
glsl2: Add support for ir_unop_neg to ir_mat_op_to_vec
Eric Anholt [Tue, 10 Aug 2010 20:06:49 +0000 (13:06 -0700)]
glsl2: Move the common optimization passes to a helper function.
These are passes that we expect all codegen to be happy with. The
other lowering passes for Mesa IR are moved to the Mesa IR generator.
Kenneth Graunke [Sat, 14 Aug 2010 00:16:43 +0000 (17:16 -0700)]
glsl2: Refresh autogenerated bison parser.
Vinson Lee [Sat, 14 Aug 2010 00:11:21 +0000 (17:11 -0700)]
Fix an MSVC build error (bugzilla 29570).
Ian Romanick [Fri, 13 Aug 2010 23:46:43 +0000 (16:46 -0700)]
glsl2: Remove unnecessary use of 'struct' before type names
In C++ you don't have to say 'struct' or 'class' if the declaration of
the type has been seen. Some compilers will complain if you use
'struct' when 'class' should have been used and vice versa.
Fixes bugzilla #29539.
Ian Romanick [Fri, 13 Aug 2010 23:22:38 +0000 (16:22 -0700)]
Add missing intmax_t and uintmax_t
Ian Romanick [Fri, 13 Aug 2010 23:22:21 +0000 (16:22 -0700)]
glsl2: Use stdint.h instead of inttypes.h
Ian Romanick [Fri, 13 Aug 2010 20:13:24 +0000 (13:13 -0700)]
glsl2: Commit generated file changed by previous commit
Ian Romanick [Fri, 13 Aug 2010 20:08:54 +0000 (13:08 -0700)]
glsl2: Use --nounistd to fix MSVC build
Also remove the --never-interactive command line option for the
preprocessor lexer. This was already done for main compiler lexer.
Ian Romanick [Fri, 13 Aug 2010 19:30:41 +0000 (12:30 -0700)]
linker: Assign attrib location 0 if gl_Vertex is not used
If gl_Vertex is not used in the shader, then attribute location 0 is
available for use.
Fixes piglit test case glsl-getattriblocation (bugzilla #29540).
Jakob Bornecrantz [Fri, 13 Aug 2010 17:36:55 +0000 (18:36 +0100)]
glsl2: Include string.h in preprocessor
Ian Romanick [Fri, 13 Aug 2010 16:34:52 +0000 (09:34 -0700)]
glsl2: Commit generated files changed by previous two commits
Ian Romanick [Fri, 13 Aug 2010 16:23:54 +0000 (09:23 -0700)]
glsl2: Avoid token name collisions with names used by Windows header files
Ian Romanick [Fri, 13 Aug 2010 16:26:01 +0000 (09:26 -0700)]
glsl2: Eliminate tokens for square matrix short names
MAT2 and MAT2X2, for example, are treated identically by the parser.
The language version based error checking (becuase mat2x2 is not
available in GLSL 1.10) is already done in the lexer.
José Fonseca [Fri, 13 Aug 2010 12:55:34 +0000 (13:55 +0100)]
scons: Build the new glsl2 code.
José Fonseca [Fri, 13 Aug 2010 12:53:04 +0000 (13:53 +0100)]
talloc: Make it compile with MSVC, MinGW, and Xcode/gcc4.0.
Based on Aras Pranckevičius' patch.
José Fonseca [Fri, 13 Aug 2010 11:31:10 +0000 (12:31 +0100)]
talloc: Import 2.0.1 code.
Ian Romanick [Fri, 13 Aug 2010 01:00:35 +0000 (18:00 -0700)]
glsl2: Use MIN2 from macros.h instead of open coding it
Ian Romanick [Thu, 12 Aug 2010 22:05:39 +0000 (15:05 -0700)]
glsl2: Use Elements from main/compiler.h instead of open-coding
Brian Paul [Thu, 12 Aug 2010 21:57:54 +0000 (15:57 -0600)]
mesa: check for null shader->InfoLog before printing
Ian Romanick [Thu, 12 Aug 2010 17:07:29 +0000 (10:07 -0700)]
glsl2: Commit generated file changed by previous commit
Ian Romanick [Thu, 12 Aug 2010 17:07:05 +0000 (10:07 -0700)]
glsl2: Add missing include of string.h
Makes the build happy on non-GCC platforms.
Jakob Bornecrantz [Thu, 12 Aug 2010 12:51:39 +0000 (13:51 +0100)]
gallium: Link DRI drivers with g++ and test with CXX
New shader compiler need libc++ runtime. This works already if
we are using llvm so this just covers the !llvm case.
Ian Romanick [Thu, 12 Aug 2010 00:19:05 +0000 (17:19 -0700)]
glsl2: Change command line options passed to flex
Remove --never-interactive because it is already specified in the
source using %option. Use -o instead of --outfile. Some of the
%option commands may also need to be removed for compatibility with
older versions (e.g., 2.5.4) of flex.
This should fix bugzilla #29209.
Ian Romanick [Thu, 12 Aug 2010 00:21:38 +0000 (17:21 -0700)]
glsl2: Commit generated files changed by previous commit
Ian Romanick [Thu, 12 Aug 2010 00:14:02 +0000 (17:14 -0700)]
glsl2: Use bison command line option to set prefix
Bison version 2.3 doesn't seem to support %name-prefix in the source.
This should fix bugzilla #29207.
Ian Romanick [Thu, 12 Aug 2010 00:03:37 +0000 (17:03 -0700)]
glsl2: Commit generated files changed by previous commit
Ian Romanick [Thu, 12 Aug 2010 00:01:31 +0000 (17:01 -0700)]
glsl2: Emit error from lexer when illegal reserved word is encountered
Without this, the parser will generate obtuse, useless error
diagnostics when reservered word that are not used by the grammar are
encountered in a shader.
Fixes bugzilla #29519.
Ian Romanick [Wed, 11 Aug 2010 23:58:25 +0000 (16:58 -0700)]
glsl2: Don't declare a variable called sig that shadows the other one
Accidentally having a variable called 'sig' within an if-statement
cause the higher scope 'sig' to always be NULL. As a result a new
function signature was created for a function definition even when one
already existed from a prototype declaration.
Fixes piglit test case glsl-function-prototype (bugzilla #29520).
Carl Worth [Wed, 11 Aug 2010 21:09:11 +0000 (14:09 -0700)]
glcpp: Fix "unterminated if" diagnostic.
This was previously being appended to the output string *after* a copy
of the supposedly final string was made and handed to the caller. So
the diagnostic was never actually visible to the user.
We fix this by moving the check for an unterminated #if from
glcpp_parser_destroy to the calling function, preprocess.
This fixes the test case 083-unterminated-if.c.
Carl Worth [Wed, 11 Aug 2010 21:00:21 +0000 (14:00 -0700)]
glccp: Regenerate glcpp-parse.c
Due to a recent change to glcpp-parse.y.
Carl Worth [Wed, 11 Aug 2010 20:59:22 +0000 (13:59 -0700)]
glcpp: Add an explicit diagnostic for #if with no expression.
This is more clear than the previously-generated diagnostic which was
something confusing like "enexpected newline".
This change makse test 080-if-witout-expression.c now pass.
Carl Worth [Wed, 11 Aug 2010 20:50:51 +0000 (13:50 -0700)]
glcpp: Reword diagnostic for #elif with no expression
Rather than telling the user what to fix, the standard convention is to
describe what the detected problem is. With this change, test
081-elif-without-expression now passes.
Carl Worth [Wed, 11 Aug 2010 20:48:13 +0000 (13:48 -0700)]
glcpp: Add several tests for diagnostics.
Which are proving to be useful since some of these tests are not yet
acting as desired, (in particular, the unterminated if test is not
generating any diagnostic).
Carl Worth [Wed, 11 Aug 2010 20:13:41 +0000 (13:13 -0700)]
glcpp: Regenerate glcpp-lex.c
After a recent change to glcpp-lex.l
Carl Worth [Wed, 11 Aug 2010 20:09:14 +0000 (13:09 -0700)]
glcpp: Initialize line and column numbers to 1, not 0.
Error messages make more sense this way since the convention is for
the first line of a file to be numbered from 1, rather than 0.
Carl Worth [Wed, 11 Aug 2010 20:06:36 +0000 (13:06 -0700)]
glcpp-test: Capture the stderr output of the preprocessor.
This allows writing tests that verify diagnostics from the preprocessor.
Brian Paul [Wed, 11 Aug 2010 20:28:55 +0000 (14:28 -0600)]
configs: added -ltalloc to config files
Brian Paul [Wed, 11 Aug 2010 20:27:56 +0000 (14:27 -0600)]
osmesa: link with new libglsl.a lib
Brian Paul [Wed, 11 Aug 2010 20:04:51 +0000 (14:04 -0600)]
glsl2: added casts to silence warnings
Brian Paul [Wed, 11 Aug 2010 20:04:32 +0000 (14:04 -0600)]
glsl2: remove stray semicolon
Brian Paul [Wed, 11 Aug 2010 20:00:36 +0000 (14:00 -0600)]
glsl2: added casts to silence warnings
Brian Paul [Wed, 11 Aug 2010 20:00:15 +0000 (14:00 -0600)]
glsl2: add cast to silence warning
Brian Paul [Wed, 11 Aug 2010 20:00:02 +0000 (14:00 -0600)]
glsl2: remove stray semicolon
Brian Paul [Wed, 11 Aug 2010 19:59:45 +0000 (13:59 -0600)]
glsl2: move declarations before code
Brian Paul [Wed, 11 Aug 2010 19:59:28 +0000 (13:59 -0600)]
glsl2: remove trailing comma to silence warning
Carl Worth [Wed, 11 Aug 2010 19:46:16 +0000 (12:46 -0700)]
glcpp: Clean up intermediate file when test suite is interrupted.
The glcpp-test script was leaving around bogus *.valgrind-errors files if
a valgrind test was interrupted.
Carl Worth [Wed, 11 Aug 2010 19:45:55 +0000 (12:45 -0700)]
glcpp: Regenerate glcpp-parse.c
After a recent change to glcpp-parse.y
Carl Worth [Wed, 11 Aug 2010 19:43:44 +0000 (12:43 -0700)]
glcpp: Additional fixes for not evaluating skipped #if/#elif expressions.
This adds a couple of test cases to expand our coverage of invalid #if and
being skipped, (either by being nested inside an #if/#elif that evaluates to
zero or by being after an #if/#elif that evaluates to non-zero).
Kenneth Graunke [Wed, 11 Aug 2010 02:16:19 +0000 (19:16 -0700)]
glcpp/tests: Commit forgotten file 074-elif-undef.c.expected.
Kenneth Graunke [Mon, 9 Aug 2010 21:03:04 +0000 (14:03 -0700)]
texture_builtins.py: Remove useless comments.
Carl Worth [Wed, 11 Aug 2010 01:27:31 +0000 (18:27 -0700)]
glcpp: Discard output of cmp when running the test suite.
We're already using the return-value of cmp to print either PASS or
FAIL and in the case of failure, we're subsequently running and
showing the output of diff. So any warnings/errors from cmp itself are
not actually needed, and can be quite confusing.
Carl Worth [Wed, 11 Aug 2010 01:25:30 +0000 (18:25 -0700)]
glcpp: Fix expected result for the 064-version.c test.
Commit
d4a04f315560704bf1103df0b93723e468725df7 caused this test case
to produce an additional blank line, which is otherwise harmless, but
does need to be reflected in the .expected file for the test to pass.
Carl Worth [Tue, 10 Aug 2010 23:59:20 +0000 (16:59 -0700)]
glcpp: Regnerate glcpp-parse.c and glcpp-parse.h
After making a minor change to the .y file.
Carl Worth [Tue, 10 Aug 2010 23:58:28 +0000 (16:58 -0700)]
glcpp: Initialize location structure at beginning of parse.
Since we have a custom structure for YYLTYPE locations, we need to use
an %initial-action directive to avoid triggering use of uninitialized
memory when, for example, printing error messages.
We apparently don't yet have a test case that allowed valgrind to find
this bug for us, but valgrind found a similar problem in the other
parser, so we fix this one as well.
Carl Worth [Tue, 10 Aug 2010 23:54:23 +0000 (16:54 -0700)]
glsl2: Regenerate glsl_parser.cpp and glsl_parser.h
After making a minor change to the .y file.
Carl Worth [Tue, 10 Aug 2010 23:52:54 +0000 (16:52 -0700)]
glsl2: Initialize location structure at beginning of parse.
Since we have a custom structure for YYLTYPE locations, we need to use
an %initial-action directive to avoid triggering use of uninitialized
memory when, for example, printing error messages.
Thanks to valgrind for noticing this bug.
Eric Anholt [Tue, 27 Jul 2010 06:56:19 +0000 (23:56 -0700)]
glsl2: Make ir_algebraic reassociate add/mul operands for constant folding.
It's rather easy to produce two constant multiplies separated by other
multiplies while writing a BRDF shader, and non-obvious enough in the
resulting codegen that I didn't catch it in my demo code until just
recently. Cuts 3 965 instructions from my demo (<1%), and 20 from
glsl-fs-raytrace (1.3%).
Eric Anholt [Tue, 10 Aug 2010 04:22:17 +0000 (21:22 -0700)]
glsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1))
All the current HW backends transform subtract to adding the negation,
so I haven't bothered peepholing it back out in Mesa IR. This allows
some subtract of subtract to get removed in ir_algebraic.
Eric Anholt [Tue, 10 Aug 2010 00:03:46 +0000 (17:03 -0700)]
glsl2: Add constant propagation.
Whereas constant folding evaluates constant expressions at rvalue
nodes, constant propagation tracks constant components of vectors
across execution to replace (possibly swizzled) variable dereferences
with constant values, triggering possible constant folding or reduced
variable liveness.
Eric Anholt [Tue, 10 Aug 2010 01:23:58 +0000 (18:23 -0700)]
i965: More s/stderr/stdout/ for program debug.
Eric Anholt [Mon, 9 Aug 2010 00:56:34 +0000 (17:56 -0700)]
glsl2: Teach copy propagation about "if" and "loop" instructions.
This lets us track copies across basic block boundaries. The loop
doesn't get a filled out list of available copies into it yet, though.
glsl-fs-raytrace drops from 585 to 535 Mesa IR instructions out of the
compiler, and it appears that Yo Frankie's largest shaders decrease in
Mesa IR count by about 10% as well.
Kenneth Graunke [Mon, 9 Aug 2010 19:45:25 +0000 (12:45 -0700)]
glsl2: Refresh autogenerated file builtin_function.cpp.
Kenneth Graunke [Sat, 7 Aug 2010 08:11:43 +0000 (01:11 -0700)]
texture_builtins.py: Fix cut and paste errors in function names.
Some signatures were being generated with the wrong function name.
Kenneth Graunke [Sat, 7 Aug 2010 09:28:40 +0000 (02:28 -0700)]
glsl2: Use gl_DepthRange's proper name.
It was being incorrectly added as gl_DepthRangeParameters, which is the
type name, not the variable name.
Ian Romanick [Mon, 9 Aug 2010 17:46:38 +0000 (10:46 -0700)]
ir_algebraic: Support other comparisons in ir_unop_logic_not
Ian Romanick [Mon, 9 Aug 2010 16:54:47 +0000 (09:54 -0700)]
ir_algebraic: Convert ir_unop_logic_not handler to use a switch statement
Currently only ir_binop_equal and ir_binop_nequal are supported, but
soon all of the relational operators will be added. Making this
change now will simplify those commits.
Aras Pranckevicius [Mon, 9 Aug 2010 08:17:32 +0000 (11:17 +0300)]
glsl2: do not use __retval name; two underscores is reserved word according to GLSL spec (and Win7 ATI drivers do complain about that)
Aras Pranckevicius [Mon, 9 Aug 2010 08:50:24 +0000 (11:50 +0300)]
glsl: fix missing return in ir_structure_splitting
Eric Anholt [Mon, 9 Aug 2010 06:29:54 +0000 (23:29 -0700)]
glsl2: Handle plain variable copies in struct splitting.
glsl-fs-raytrace goes from 620 Mesa IR instructions out of the
compiler to 585.
Kenneth Graunke [Sat, 7 Aug 2010 07:50:08 +0000 (00:50 -0700)]
glsl2: Add the 1.30 reserved keywords.
Aras Pranckevicius [Fri, 6 Aug 2010 10:31:56 +0000 (12:31 +0200)]
ir_function_inlining: Fix missing iter.next() in inlining sampler params.
Fixes glsl-fs-function-samplers.