Ian Romanick
fa455fc2a5
Generate errors for empty constructors instead of asserting
...
This causes the following tests to pass:
glslparsertest/glsl2/constructor-10.vert
2010-06-23 13:58:34 -07:00
Eric Anholt
53e48d3f63
Fix multiple usage of an rvalue in constructor component splitting.
...
Store the thing in a variable and deref it for each swizzle if we have to.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-06-23 10:55:25 -07:00
Eric Anholt
ac95f2f8c8
Include stdio.h and stdlib.h everywhere, and don't cook our own #define NULL.
2010-06-22 12:30:55 -07:00
Ian Romanick
b74b43e4ba
Use statically typed ir_constant constructors wherever possible
2010-06-11 17:12:23 -07:00
Ian Romanick
be1d2bfdea
Matrix and vector constructors with a single constant scalar are constant
2010-06-11 15:48:26 -07:00
Ian Romanick
2cf0969de5
Remove redundant type checks for constant constructors
...
All of the cases (e.g., arrays and structures) that were being
filtered by these tests were already filtered by the earlier
is_numeric and is_boolean tests.
2010-06-11 15:37:34 -07:00
Ian Romanick
1a872b1af3
Do simple constant folding while processing function call parameters
2010-06-11 15:37:34 -07:00
Ian Romanick
ab92d0e53e
Detect and process constant record constructors
2010-06-11 13:51:42 -07:00
Ian Romanick
c077131c0f
Move parameter processing out of match_function_by_name
...
Eventually code that processes constant structure constructors will
need to use the processed list of parameters.
2010-06-11 13:51:42 -07:00
Ian Romanick
00eb466e38
Constant-fold constructor parameters after type conversion
...
This causes the following tests to pass:
glslparsertest/shaders/CorrectMatComma2.frag
One of the incorrect errors in glslparsertest/shaders/CorrectComma.frag
is also eliminated.
2010-06-11 13:51:42 -07:00
Ian Romanick
9e08d019ce
Make constructors with all constant parameters generate in-line constants
2010-06-11 13:51:09 -07:00
Ian Romanick
c9cb1032be
Derefence components of constants smarter
...
During generation of calls to constructors, derefernce constants by creating
new constants instead of creating dereferences.
2010-06-11 13:51:09 -07:00
Ian Romanick
565185cd8f
Use ir_unop_b2i when converting a bool-to-int and add a missing break
...
The previous code just had dumb cut-and-paste errors.
2010-06-11 13:49:00 -07:00
Ian Romanick
70fe8b6663
Begin refactoring ir_dereference
...
Create separate subclasses of ir_dereference for variable, array, and
record dereferences. As a side effect, array and record dereferences
no longer point to ir_variable objects directly. Instead they each
point to an ir_dereference_variable object.
This is the first of several steps in the refactoring process. The
intention is that ir_dereference will eventually become an abstract
base class.
2010-05-26 15:23:19 -07:00
Ian Romanick
304ea90233
Convert ast_node use of simple_node to exec_list and exec_node
2010-05-10 11:17:53 -07:00
Ian Romanick
3521f0bdd5
Store AST function call parameters in expressions
...
Previously the list of function call parameters was stored as a
circular list in ast_expression::subexpressions[1]. They are now
stored as a regular list in ast_expression::expressions.
2010-05-10 11:04:02 -07:00
Ian Romanick
82baaf4283
glsl_type::generate_constructor_prototype now generates the function too
...
Also, change the name of the method to generate_constructor.
2010-04-28 18:22:54 -07:00
Eric Anholt
f1ddca9f21
Clarify the types of various exec_list in ir.h
2010-04-07 17:23:23 -07:00
Ian Romanick
cb9cba20a0
Use glsl_type::element_type to get the type of array elements
2010-04-02 16:08:44 -07:00
Ian Romanick
c35bb00130
Ensure that 'in' and 'inout' formal parameters are valid lvalues
...
This causes the following tests to pass:
glslparsertest/shaders/function10.frag
2010-04-02 15:51:02 -07:00
Eric Anholt
c2cb84e17b
Add bool/int conversion as IR operations.
...
Fixes constructor-09.glsl and CorrectParse2.frag.
2010-04-02 11:22:41 -07:00
Eric Anholt
dc58b3f8cc
Add conversion of bool to float as an IR operation to match int to float.
2010-04-02 11:22:41 -07:00
Ian Romanick
00aa173c9c
Generate array constructor calls
2010-03-31 16:48:48 -07:00
Ian Romanick
68515ee6c2
Refactor parts of match_function_by_name into process_parameters and process_call
...
These will be used in the functions that implement calls to array constructors.
2010-03-31 16:28:51 -07:00
Ian Romanick
b6326abb85
Reject array constructor calls in GLSL 1.10
2010-03-31 16:25:21 -07:00
Ian Romanick
3e0ef5f81b
Use ast_type_specifier::glsl_type to get the type of a constructor
...
This is the first baby step towards getting array constructors working.
2010-03-31 16:22:56 -07:00
Ian Romanick
8a24cd5cea
Allow single-component constructors
...
This causes the following tests to pass:
glslparsertest/shaders/CorrectVersion.V110.frag
shaders/glsl-vs-sqrt-zero.frag
shaders/glsl-vs-sqrt-zero.vert
This causes the following tests to fail. These shaders were
previously failing to compile, but they were all failing for the wrong
reasons.
glslparsertest/shaders/attribute1.vert
glslparsertest/shaders/attribute2.vert
glslparsertest/shaders/main2.vert
2010-03-29 16:07:34 -07:00
Ian Romanick
0b7dcc80eb
Initial implementation of constructor handling code
...
All of the scalar, vector, and matrix constructors *except* "from
bool" constructors should be handled. Array and structure
constructors are also not yet handled.
2010-03-26 17:38:58 -07:00
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
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
8bde4cec6b
Use glsl_symbol_table instead of using _mesa_symbol_table directly
2010-03-19 11:57:24 -07:00
Ian Romanick
f4749610ed
Factor guts of function matching code out to match_function_by_name
...
This function will be used for matching some types of constructors as well.
2010-03-15 13:26:02 -07:00
Ian Romanick
548fa293a3
Move ast_function_expression::hir to ast_function.cpp
2010-03-15 13:04:13 -07:00