mesa.git
14 years agolinker: Include compiler.h to avoid spurious warnings about INLINE
Ian Romanick [Mon, 16 Aug 2010 20:59:34 +0000 (13:59 -0700)]
linker: Include compiler.h to avoid spurious warnings about INLINE

14 years agoglsl2: Silence unused variable warning
Ian Romanick [Mon, 16 Aug 2010 20:59:01 +0000 (13:59 -0700)]
glsl2: Silence unused variable warning

14 years agoglcpp: Refresh autogenerated lexer and parser.
Kenneth Graunke [Mon, 16 Aug 2010 20:43:10 +0000 (13:43 -0700)]
glcpp: Refresh autogenerated lexer and parser.

14 years agoglcpp: Remove spurious newline generated by #version handling.
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.

14 years agoir_to_mesa: Silence unused variable warnings
Ian Romanick [Mon, 16 Aug 2010 16:45:01 +0000 (09:45 -0700)]
ir_to_mesa: Silence unused variable warnings

14 years agoir_to_mesa: Clean up assertions in ir_to_mesa_visitor::visit(ir_texture *)
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 *)

14 years agoir_to_mesa: Support texture rectangle targets
Ian Romanick [Mon, 16 Aug 2010 16:39:58 +0000 (09:39 -0700)]
ir_to_mesa: Support texture rectangle targets

14 years agost/mesa: remove output register reads inside shaders
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.

14 years agomesa: Check that _XOPEN_SOURCE is defined before using it.
Vinson Lee [Sun, 15 Aug 2010 20:08:15 +0000 (13:08 -0700)]
mesa: Check that _XOPEN_SOURCE is defined before using it.

14 years agoRevert "glsl2: Use stdint.h instead of inttypes.h"
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.

14 years agoReplace our custom C99 headers with http://code.google.com/p/msinttypes/
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.

14 years agoglsl: Standardize a few more uses of struct vs class keyword.
José Fonseca [Sat, 14 Aug 2010 14:35:57 +0000 (15:35 +0100)]
glsl: Standardize a few more uses of struct vs class keyword.

14 years agoscons: Link talloc.
José Fonseca [Sat, 14 Aug 2010 14:29:15 +0000 (15:29 +0100)]
scons: Link talloc.

14 years agoglsl: Silence gcc warning "control reaches end of non-void function".
José Fonseca [Sat, 14 Aug 2010 13:40:39 +0000 (14:40 +0100)]
glsl: Silence gcc warning "control reaches end of non-void function".

14 years agomesa: 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".

14 years agomesa: Silence gcc warning "missing initializer for member".
José Fonseca [Sat, 14 Aug 2010 13:38:09 +0000 (14:38 +0100)]
mesa: Silence gcc warning "missing initializer for member".

14 years agomesa: Recent versions of MSVC define the single precision functions already.
José Fonseca [Sat, 14 Aug 2010 12:10:24 +0000 (13:10 +0100)]
mesa: Recent versions of MSVC define the single precision functions already.

14 years agoscons: Add new source files.
José Fonseca [Sat, 14 Aug 2010 11:45:14 +0000 (12:45 +0100)]
scons: Add new source files.

14 years agomesa: atan2f and powf need two args.
José Fonseca [Sat, 14 Aug 2010 11:43:56 +0000 (12:43 +0100)]
mesa: atan2f and powf need two args.

14 years agoMerge branch 'master' into glsl2
Ian Romanick [Sat, 14 Aug 2010 03:22:46 +0000 (20:22 -0700)]
Merge branch 'master' into glsl2

14 years agomesa: Work-arounds for platforms that lack C99 math functions
Ian Romanick [Sat, 14 Aug 2010 03:18:08 +0000 (20:18 -0700)]
mesa: Work-arounds for platforms that lack C99 math functions

14 years agoglsl2/Makefile: Add a 'make builtins' target.
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.

14 years agoglsl2: Rework builtin function generation.
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.

14 years agoir_reader: Don't mark functions as defined if their body is empty.
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.

14 years agoglsl2: Commit generated file change by commit ab18be74
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.

14 years agoglsl2: Add a pass to strip out noop swizzles.
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.

14 years agoglsl2: Convert ir_constant_propagation to ir_rvalue_visitor.
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.

14 years agoglsl2: Add a generic visitor class to call back with pointers to each rvalue.
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.

14 years agomesa: Avoid using c++ keyword in dri_util.h when compiled with c++.
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++.

14 years agointel: Remove include of texmem.h, since we haven't used it in ages.
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.

14 years agoglsl2: Move ir_to_mesa handling to driver CompileShader and LinkShader hooks.
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.

14 years agoglsl2: Add support for ir_unop_neg to ir_mat_op_to_vec
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

14 years agoglsl2: Move the common optimization passes to a helper function.
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.

14 years agoglsl2: Refresh autogenerated bison parser.
Kenneth Graunke [Sat, 14 Aug 2010 00:16:43 +0000 (17:16 -0700)]
glsl2: Refresh autogenerated bison parser.

14 years agoFix an MSVC build error (bugzilla 29570).
Vinson Lee [Sat, 14 Aug 2010 00:11:21 +0000 (17:11 -0700)]
Fix an MSVC build error (bugzilla 29570).

14 years agoglsl2: Remove unnecessary use of 'struct' before type names
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.

14 years agoAdd missing intmax_t and uintmax_t
Ian Romanick [Fri, 13 Aug 2010 23:22:38 +0000 (16:22 -0700)]
Add missing intmax_t and uintmax_t

14 years agoglsl2: Use stdint.h instead of inttypes.h
Ian Romanick [Fri, 13 Aug 2010 23:22:21 +0000 (16:22 -0700)]
glsl2: Use stdint.h instead of inttypes.h

14 years agoglsl2: Commit generated file changed by previous commit
Ian Romanick [Fri, 13 Aug 2010 20:13:24 +0000 (13:13 -0700)]
glsl2: Commit generated file changed by previous commit

14 years agoglsl2: Use --nounistd to fix MSVC build
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.

14 years agolinker: Assign attrib location 0 if gl_Vertex is not used
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).

14 years agoglsl2: Include string.h in preprocessor
Jakob Bornecrantz [Fri, 13 Aug 2010 17:36:55 +0000 (18:36 +0100)]
glsl2: Include string.h in preprocessor

14 years agoglsl2: Commit generated files changed by previous two commits
Ian Romanick [Fri, 13 Aug 2010 16:34:52 +0000 (09:34 -0700)]
glsl2: Commit generated files changed by previous two commits

14 years agoglsl2: Avoid token name collisions with names used by Windows header files
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

14 years agoglsl2: Eliminate tokens for square matrix short names
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.

14 years agoscons: Build the new glsl2 code.
José Fonseca [Fri, 13 Aug 2010 12:55:34 +0000 (13:55 +0100)]
scons: Build the new glsl2 code.

14 years agotalloc: Make it compile with MSVC, MinGW, and Xcode/gcc4.0.
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.

14 years agotalloc: Import 2.0.1 code.
José Fonseca [Fri, 13 Aug 2010 11:31:10 +0000 (12:31 +0100)]
talloc: Import 2.0.1 code.

14 years agoglsl2: Use MIN2 from macros.h instead of open coding it
Ian Romanick [Fri, 13 Aug 2010 01:00:35 +0000 (18:00 -0700)]
glsl2: Use MIN2 from macros.h instead of open coding it

14 years agoglsl2: Use Elements from main/compiler.h instead of open-coding
Ian Romanick [Thu, 12 Aug 2010 22:05:39 +0000 (15:05 -0700)]
glsl2: Use Elements from main/compiler.h instead of open-coding

14 years agomesa: check for null shader->InfoLog before printing
Brian Paul [Thu, 12 Aug 2010 21:57:54 +0000 (15:57 -0600)]
mesa: check for null shader->InfoLog before printing

14 years agoglsl2: Commit generated file changed by previous commit
Ian Romanick [Thu, 12 Aug 2010 17:07:29 +0000 (10:07 -0700)]
glsl2: Commit generated file changed by previous commit

14 years agoglsl2: Add missing include of string.h
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.

14 years agogallium: Link DRI drivers with g++ and test with CXX
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.

14 years agoglsl2: Change command line options passed to flex
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.

14 years agoglsl2: Commit generated files changed by previous commit
Ian Romanick [Thu, 12 Aug 2010 00:21:38 +0000 (17:21 -0700)]
glsl2: Commit generated files changed by previous commit

14 years agoglsl2: Use bison command line option to set prefix
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.

14 years agoglsl2: Commit generated files changed by previous commit
Ian Romanick [Thu, 12 Aug 2010 00:03:37 +0000 (17:03 -0700)]
glsl2: Commit generated files changed by previous commit

14 years agoglsl2: Emit error from lexer when illegal reserved word is encountered
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.

14 years agoglsl2: Don't declare a variable called sig that shadows the other one
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).

14 years agoglcpp: Fix "unterminated if" diagnostic.
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.

14 years agoglccp: Regenerate glcpp-parse.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.

14 years agoglcpp: Add an explicit diagnostic for #if with no expression.
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.

14 years agoglcpp: Reword diagnostic for #elif with no expression
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.

14 years agoglcpp: Add several tests for diagnostics.
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).

14 years agoglcpp: Regenerate glcpp-lex.c
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

14 years agoglcpp: Initialize line and column numbers to 1, not 0.
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.

14 years agoglcpp-test: Capture the stderr output of the preprocessor.
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.

14 years agoconfigs: added -ltalloc to config files
Brian Paul [Wed, 11 Aug 2010 20:28:55 +0000 (14:28 -0600)]
configs: added -ltalloc to config files

14 years agoosmesa: link with new libglsl.a lib
Brian Paul [Wed, 11 Aug 2010 20:27:56 +0000 (14:27 -0600)]
osmesa: link with new libglsl.a lib

14 years agoglsl2: added casts to silence warnings
Brian Paul [Wed, 11 Aug 2010 20:04:51 +0000 (14:04 -0600)]
glsl2: added casts to silence warnings

14 years agoglsl2: remove stray semicolon
Brian Paul [Wed, 11 Aug 2010 20:04:32 +0000 (14:04 -0600)]
glsl2: remove stray semicolon

14 years agoglsl2: added casts to silence warnings
Brian Paul [Wed, 11 Aug 2010 20:00:36 +0000 (14:00 -0600)]
glsl2: added casts to silence warnings

14 years agoglsl2: add cast to silence warning
Brian Paul [Wed, 11 Aug 2010 20:00:15 +0000 (14:00 -0600)]
glsl2: add cast to silence warning

14 years agoglsl2: remove stray semicolon
Brian Paul [Wed, 11 Aug 2010 20:00:02 +0000 (14:00 -0600)]
glsl2: remove stray semicolon

14 years agoglsl2: move declarations before code
Brian Paul [Wed, 11 Aug 2010 19:59:45 +0000 (13:59 -0600)]
glsl2: move declarations before code

14 years agoglsl2: remove trailing comma to silence warning
Brian Paul [Wed, 11 Aug 2010 19:59:28 +0000 (13:59 -0600)]
glsl2: remove trailing comma to silence warning

14 years agoglcpp: Clean up intermediate file when test suite is interrupted.
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.

14 years agoglcpp: Regenerate glcpp-parse.c
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

14 years agoglcpp: Additional fixes for not evaluating skipped #if/#elif expressions.
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).

14 years agoglcpp/tests: Commit forgotten file 074-elif-undef.c.expected.
Kenneth Graunke [Wed, 11 Aug 2010 02:16:19 +0000 (19:16 -0700)]
glcpp/tests: Commit forgotten file 074-elif-undef.c.expected.

14 years agotexture_builtins.py: Remove useless comments.
Kenneth Graunke [Mon, 9 Aug 2010 21:03:04 +0000 (14:03 -0700)]
texture_builtins.py: Remove useless comments.

14 years agoglcpp: Discard output of cmp when running the test suite.
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.

14 years agoglcpp: Fix expected result for the 064-version.c test.
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.

14 years agoglcpp: Regnerate glcpp-parse.c and glcpp-parse.h
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.

14 years agoglcpp: Initialize location structure at beginning of parse.
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.

14 years agoglsl2: Regenerate glsl_parser.cpp and glsl_parser.h
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.

14 years agoglsl2: Initialize location structure at beginning of parse.
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.

14 years agoglsl2: Make ir_algebraic reassociate add/mul operands for constant folding.
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%).

14 years agoglsl2: Add a pass to transform ir_binop_sub to add(op0, neg(op1))
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.

14 years agoglsl2: Add constant propagation.
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.

14 years agoi965: More s/stderr/stdout/ for program debug.
Eric Anholt [Tue, 10 Aug 2010 01:23:58 +0000 (18:23 -0700)]
i965: More s/stderr/stdout/ for program debug.

14 years agoglsl2: Teach copy propagation about "if" and "loop" instructions.
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.

14 years agoglsl2: Refresh autogenerated file builtin_function.cpp.
Kenneth Graunke [Mon, 9 Aug 2010 19:45:25 +0000 (12:45 -0700)]
glsl2: Refresh autogenerated file builtin_function.cpp.

14 years agotexture_builtins.py: Fix cut and paste errors in function names.
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.

14 years agoglsl2: Use gl_DepthRange's proper 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.

14 years agoir_algebraic: Support other comparisons in ir_unop_logic_not
Ian Romanick [Mon, 9 Aug 2010 17:46:38 +0000 (10:46 -0700)]
ir_algebraic: Support other comparisons in ir_unop_logic_not

14 years agoir_algebraic: Convert ir_unop_logic_not handler to use a switch statement
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.

14 years agoglsl2: do not use __retval name; two underscores is reserved word according to GLSL...
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)

14 years agoglsl: fix missing return in ir_structure_splitting
Aras Pranckevicius [Mon, 9 Aug 2010 08:50:24 +0000 (11:50 +0300)]
glsl: fix missing return in ir_structure_splitting