Commit Graph

218 Commits

Author SHA1 Message Date
Kenneth Graunke
fb9fb5f51d Add new abstract ir_rvalue class; rework accordingly.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 13:58:48 -07:00
Kenneth Graunke
44e1dfa2df Replace "mode" type tag with virtual as_foo() downcasting functions.
These should work well even in a non-flat IR hierarchy.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 12:50:40 -07:00
Ian Romanick
b7592c362b Merge branch 'anholt' 2010-03-25 18:41:41 -07:00
Ian Romanick
7954922473 IR print visitor: Finish printing constants 2010-03-25 18:40:48 -07:00
Ian Romanick
d14642739e IR print visitor: Remove most of the newlines from the printed output
This makes it a lot easier to read... if you have a really wide display.
2010-03-25 18:40:48 -07:00
Ian Romanick
d7388f389d IR print visitor: print expressions
Not quite complete.  The operator is not yet printed.
2010-03-25 18:40:48 -07:00
Ian Romanick
8c70a62193 IR print visitor: print ir_dereference instructions
Also make a slight change to ir_variable.  The ir_dereference tracks
the number of nested dereferences.  If an ir_variable is visited and
the count is non-zero, just print the name of the variable.
2010-03-25 18:40:36 -07:00
Ian Romanick
6e7c278e24 IR print visitor: Less newlines when printing ir_variables 2010-03-25 18:39:59 -07:00
Eric Anholt
ece0a51160 Fix assignment operators: *=, /=, +=, -=.
Basically, replace everything different from operator_assign other
than the creation of the rhs value from the lvalue and rvalue with the
contents of operator_assign.  Fixes a segfault in
CorrectSwizzle1.frag, and fixes parser10.frag.
2010-03-25 17:10:44 -07:00
Ian Romanick
a4e92c4b26 Before generating HIR for user code, generate constructors for built-in types 2010-03-25 17:02:22 -07:00
Ian Romanick
9546997736 Add dereference constructor for array element dereferences
This should have gone in before the previous commit.
2010-03-25 17:01:15 -07:00
Ian Romanick
720c88eab9 Add functions to generate constructors for built-in types.
Currently only vector and matrix types are supported.  Structure types will be
added later.
2010-03-25 16:58:45 -07:00
Eric Anholt
2f9ca7dce2 Fix up the operator printing for the logic or and beyond, check array bounds. 2010-03-25 16:47:49 -07:00
Ian Romanick
acb36240e5 Merge branch 'anholt' 2010-03-25 16:02:41 -07:00
Eric Anholt
b3f743ab0b Set up fragment shader builtin variables. 2010-03-25 14:48:25 -07:00
Eric Anholt
7c15bb2465 Make the standalone parser return an exit code so we can automate testing. 2010-03-25 14:37:25 -07:00
Ian Romanick
68507eceea More matrix compilation tests 2010-03-25 13:41:32 -07:00
Ian Romanick
3d303eb59f Merge branch 'kwg' 2010-03-25 13:22:19 -07:00
Ian Romanick
1b4f04124a Fix matrix dimensioning
Newb GL mistake: matrices in GL are column-major.  This means that
vector_elements is the number of rows.  Making these changes causes
matrix-08.glsl to pass.
2010-03-25 13:19:13 -07:00
Ian Romanick
c1bd3a1a61 Use glsl_type::row_type and glsl_type::column type in arithmetic_result_type
This substantially clarifies the code for matching matrix types.  It
also eliminates some uses of glsl_type member data.
2010-03-25 13:06:58 -07:00
Ian Romanick
80b5ed6e63 Replace several glsl_type field comparisons with a single pointer comparison
This simplifies the process of matching function parameter types.
More simplifications are probably possible here, but arrays and
structures need to be implemented first.
2010-03-25 13:05:43 -07:00
Ian Romanick
252127c379 Add queries to get the glsl_type of a row or column of a matrix 2010-03-25 11:42:45 -07:00
Kenneth Graunke
f25a5ad939 Widen num_components to handle vec4 correctly. 2010-03-25 11:22:42 -07:00
Kenneth Graunke
904872372e Typo fixes: de/re/ference. 2010-03-25 10:18:40 -07:00
Ian Romanick
664da2510a Replace several field comparisons with a single pointer comparison
The only way the specified type fields can match is if the types are the
same.  Previous tests (and assertions) have filtered away all other possible
cases.
2010-03-24 17:53:53 -07:00
Ian Romanick
532edd9bc4 Remove unused _mesa_glsl_get_vector_type
This function has been completely replaced by glsl_type::get_instance.
2010-03-24 17:47:20 -07:00
Ian Romanick
c4e2627045 Use glsl_type::get_instance instead of _mesa_glsl_get_vector_type 2010-03-24 17:46:39 -07:00
Ian Romanick
d2b6bc651a Use glsl_type::get_instance instead of symbol table look-up 2010-03-24 17:45:14 -07:00
Ian Romanick
e4fca97afd Add some matrix math tests 2010-03-24 17:42:59 -07:00
Ian Romanick
3209c4e369 Add glsl_type::get_instance method
Gets the singleton corresponding to a particular scalar, vector, or
matrix type.
2010-03-24 17:11:30 -07:00
Ian Romanick
60b54d977a Replace accesses to glsl_type data with query functions
In these particular cases, using the query functions makes it more obvious
what is happening.
2010-03-24 17:08:13 -07:00
Ian Romanick
9ff8f3777e Add class-private handles to matrix types in glsl_type 2010-03-24 17:05:09 -07:00
Ian Romanick
4d184a1d02 Fix typo in swizzle processing loop
One of the accesses to str in the loop used str[0] instead of str[i].

Reported-by: Kenneth Graunke
2010-03-24 15:27:50 -07:00
Ian Romanick
9e97ffb754 Trivial cleanups in generate_swizzle
Add 'const' and 'static const' in a couple of places.
2010-03-24 15:27:04 -07:00
Ian Romanick
afbe26fd61 Use ir_dereference::set_swizzle 2010-03-24 15:25:23 -07:00
Ian Romanick
2f4240fb02 Add method to set the swizzle of an ir_dereference 2010-03-24 15:12:21 -07:00
Ian Romanick
44bb1a62f9 Allow duplicate symbols at the same scope that are in different name spaces 2010-03-24 14:56:36 -07:00
Ian Romanick
d00b7958c0 Merge branch 'anholt' 2010-03-24 12:10:39 -07:00
Ian Romanick
7d9bce3551 Add (negative) test for constructing samplers 2010-03-24 12:08:46 -07:00
Ian Romanick
882dad7540 ir_function constructor now takes the function name as a parameter 2010-03-23 17:42:04 -07:00
Ian Romanick
bb7e00a1cd Add glsl_type::get_base_type query
Retreives the glsl_type that corresponds to the base type of a numeric scalar /
vector / matrix type.  So vec4 returns float, etc.
2010-03-23 17:31:39 -07:00
Ian Romanick
7aeb6abda7 Add glsl_type::is_numeric and glsl_type::is_boolean queries 2010-03-23 17:31:03 -07:00
Ian Romanick
abef955764 Begin processing constructors
Right now, reject constructors for samplers because the are illegal.
2010-03-23 15:08:30 -07:00
Ian Romanick
cb7d066967 Add query to determine whether a type is a sampler 2010-03-23 15:03:46 -07:00
Ian Romanick
1e5cd2b05b Add test for invalid assignment of function return value 2010-03-23 13:23:53 -07:00
Ian Romanick
0bb1c3c153 Add *some* type checking for assignments 2010-03-23 13:23:31 -07:00
Ian Romanick
71d0bbfcb2 Disallow passing NULL for state to _mesa_glsl_error
The two places that were still passing NULL had a state pointer to
pass.  Not passing it in these places prevented termination of
compilation of erroneous programs.
2010-03-23 13:21:19 -07:00
Ian Romanick
f3f111eac4 Fix typographical errors of "FINISHME" 2010-03-23 13:04:19 -07:00
Eric Anholt
f41fc53728 Include other generated sources in BUILT_SOURCES.
Otherwise, having cleaned glsl_parser.h, we'd never regenerate it because
glsl_parser.cpp was already right where it needed to be.
2010-03-23 12:32:25 -07:00
Eric Anholt
e5ba18083b Use bash for the built file generation since builtin_types.sh requires it. 2010-03-23 12:32:25 -07:00