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
Eric Anholt
6985a43832
Clean the built sources with make clean.
2010-03-23 12:32:25 -07:00
Ian Romanick
cec65a6b76
Generate an error for variables declared with type void
2010-03-23 12:28:44 -07:00
Ian Romanick
8400bc4d35
Add is_error and is_void type queries
2010-03-23 12:28:28 -07:00
Ian Romanick
9e7c34b865
Set the type of a function call to be the return type of the callee
2010-03-23 12:21:18 -07:00
Ian Romanick
e39cc69fa3
Set, and require, a return type for function signatures
2010-03-23 12:19:13 -07:00
Ian Romanick
7563b50075
Add `void' type to table of available types
...
This will make void-01.glsl test fail, so I may regret this later.
However, this will make supporting functions that return void or
functions that have a void parameter list easier to handle.
2010-03-23 12:11:50 -07:00
Ian Romanick
693bb11b5f
Rename test GLSL sources from .txt to .glsl
2010-03-23 11:57:24 -07:00
Ian Romanick
f8f1085e5e
Add test for declaring variables of type void.
2010-03-23 11:54:03 -07:00