Commit graph

37526 commits

Author SHA1 Message Date
José Fonseca
19acfa42ed mesa: Silence gcc warning "control reaches end of non-void function". 2010-08-14 14:40:06 +01:00
José Fonseca
325aa1b3cd mesa: Silence gcc warning "missing initializer for member". 2010-08-14 14:38:09 +01:00
José Fonseca
8881b0fe43 mesa: Recent versions of MSVC define the single precision functions already. 2010-08-14 13:10:24 +01:00
José Fonseca
2322404b55 scons: Add new source files. 2010-08-14 12:45:14 +01:00
José Fonseca
68f602afb1 mesa: atan2f and powf need two args. 2010-08-14 12:44:41 +01:00
Ian Romanick
443a7e4e9a Merge branch 'master' into glsl2 2010-08-13 20:22:46 -07:00
Ian Romanick
2f8ee757ab mesa: Work-arounds for platforms that lack C99 math functions 2010-08-13 20:18:08 -07:00
Kenneth Graunke
9364ad8528 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.
2010-08-13 19:09:36 -07:00
Kenneth Graunke
43ff8f1a4b 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.
2010-08-13 19:09:36 -07:00
Kenneth Graunke
d802ba110f ir_reader: Don't mark functions as defined if their body is empty. 2010-08-13 19:09:35 -07:00
Ian Romanick
d01bf822dd 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.
2010-08-13 19:05:54 -07:00
Eric Anholt
8f8cdbfba4 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.
2010-08-13 17:54:47 -07:00
Eric Anholt
42cab131da glsl2: Convert ir_constant_propagation to ir_rvalue_visitor.
This one is a little tricky because of the LHS handling.
2010-08-13 17:54:47 -07:00
Eric Anholt
b3b0cf6a4c 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.
2010-08-13 17:54:46 -07:00
Eric Anholt
9c3acce680 mesa: Avoid using c++ keyword in dri_util.h when compiled with c++. 2010-08-13 17:54:46 -07:00
Eric Anholt
c374487a54 intel: Remove include of texmem.h, since we haven't used it in ages. 2010-08-13 17:54:46 -07:00
Eric Anholt
d19eecef54 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.
2010-08-13 17:54:42 -07:00
Eric Anholt
013bbbbb0a glsl2: Add support for ir_unop_neg to ir_mat_op_to_vec 2010-08-13 17:47:00 -07:00
Eric Anholt
2f4fe15168 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.
2010-08-13 17:47:00 -07:00
Kenneth Graunke
c55aa4292f glsl2: Refresh autogenerated bison parser. 2010-08-13 17:16:43 -07:00
Vinson Lee
07ca55b7fa Fix an MSVC build error (bugzilla 29570). 2010-08-13 17:11:21 -07:00
Ian Romanick
768b55a526 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.
2010-08-13 16:46:43 -07:00
Ian Romanick
d960b61ea3 Add missing intmax_t and uintmax_t 2010-08-13 16:22:38 -07:00
Ian Romanick
a77a6bc008 glsl2: Use stdint.h instead of inttypes.h 2010-08-13 16:22:21 -07:00
Ian Romanick
23f6017d70 glsl2: Commit generated file changed by previous commit 2010-08-13 14:50:53 -07:00
Ian Romanick
ab18be74ac 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.
2010-08-13 14:50:53 -07:00
Ian Romanick
c33e78f62b 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).
2010-08-13 14:50:48 -07:00
Jakob Bornecrantz
204d4cbea0 glsl2: Include string.h in preprocessor 2010-08-13 18:36:55 +01:00
Ian Romanick
103453659d glsl2: Commit generated files changed by previous two commits 2010-08-13 09:34:52 -07:00
Ian Romanick
5c77efc0b2 glsl2: Avoid token name collisions with names used by Windows header files 2010-08-13 09:30:56 -07:00
Ian Romanick
5b9f3db719 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.
2010-08-13 09:29:39 -07:00
José Fonseca
3a3cdb909d scons: Build the new glsl2 code. 2010-08-13 13:55:34 +01:00
José Fonseca
1ca2945f84 talloc: Make it compile with MSVC, MinGW, and Xcode/gcc4.0.
Based on Aras Pranckevičius' patch.
2010-08-13 13:53:04 +01:00
José Fonseca
e6032b1d96 talloc: Import 2.0.1 code. 2010-08-13 12:31:10 +01:00
Ian Romanick
0dc39f481a glsl2: Use MIN2 from macros.h instead of open coding it 2010-08-12 18:01:14 -07:00
Ian Romanick
261bbc011d glsl2: Use Elements from main/compiler.h instead of open-coding 2010-08-12 15:05:39 -07:00
Brian Paul
2d83e3fa0d mesa: check for null shader->InfoLog before printing 2010-08-12 16:00:01 -06:00
Ian Romanick
4ca4edd20e glsl2: Commit generated file changed by previous commit 2010-08-12 10:09:05 -07:00
Ian Romanick
188f60fb05 glsl2: Add missing include of string.h
Makes the build happy on non-GCC platforms.
2010-08-12 10:09:05 -07:00
Jakob Bornecrantz
4f51762b07 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.
2010-08-12 16:04:11 +01:00
Ian Romanick
5a805079a8 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.
2010-08-11 17:21:53 -07:00
Ian Romanick
a43871f763 glsl2: Commit generated files changed by previous commit 2010-08-11 17:21:53 -07:00
Ian Romanick
2fb94b37d2 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.
2010-08-11 17:14:02 -07:00
Ian Romanick
db36e88052 glsl2: Commit generated files changed by previous commit 2010-08-11 17:03:37 -07:00
Ian Romanick
77215e7e7b 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.
2010-08-11 17:03:31 -07:00
Ian Romanick
202604e816 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).
2010-08-11 16:58:25 -07:00
Carl Worth
da6b10a7eb 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.
2010-08-11 14:38:04 -07:00
Carl Worth
6b9e7b034c glccp: Regenerate glcpp-parse.c
Due to a recent change to glcpp-parse.y.
2010-08-11 14:38:04 -07:00
Carl Worth
253cad3f42 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.
2010-08-11 14:38:04 -07:00
Carl Worth
624dd585c7 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.
2010-08-11 14:38:03 -07:00