Commit Graph

453 Commits

Author SHA1 Message Date
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
Ian Romanick cf37c9e8da Additional void parameter checks
If there is a void parameter it must not have a name, and it must be
the only parameter.
2010-04-02 15:30:45 -07:00
Ian Romanick 45d8a70c12 Require that function formal parameters have names 2010-04-02 15:09:33 -07:00
Ian Romanick 3f9a73d121 Make built-in gl_TexCoord available in vertex and fragment shaders 2010-04-02 11:59:57 -07:00
Ian Romanick fe1c7ff6c6 Fix matching of integer function parameters
This causes the following tests to pass:

    glslparsertest/shaders/function10.frag
2010-04-02 11:45:06 -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
Eric Anholt 106d122318 Add PASS / FAIL annotations to tests missing them.
This tricked my import of the tests into piglit.
2010-04-02 11:22:41 -07:00
Eric Anholt 3f15150932 Test that invalid quailfiers aren't used on variables in GLSL 1.10. 2010-04-02 11:22:41 -07:00
Eric Anholt c7da28b4be Allow array dereferences to be considered as lvalues.
Fixes glsl-vs-arrays.vert and glsl-vs-mov-after-deref.vert.
Regresses parser3.frag which was failing for the wrong reason.
2010-04-02 11:22:41 -07:00
Eric Anholt 5150c567a0 Test for the type being different in parameter_lists_match.
Fixes CorrectFuncOverload.frag.
2010-04-02 11:22:41 -07:00
Eric Anholt d251b92f8d Add some more operations to ir_constant_expression.cpp. 2010-04-02 11:22:41 -07:00
Eric Anholt d98da9738e Make ir_constant_expression.cpp support multi-component types. 2010-04-02 11:22:41 -07:00
Eric Anholt 160d092507 Simplify ir_constant_expression.cpp by factoring operand computation out. 2010-04-02 11:22:41 -07:00
Eric Anholt 90b7825b0e Reject non-float varyings.
Fixes varying2.frag.
2010-04-02 11:22:41 -07:00
Eric Anholt aeab105342 Remove fake ir_binop_logic_not. I think you meant ir_unop_logic_not. 2010-04-02 11:22:41 -07:00
Eric Anholt 528bb85359 Handle logic not in constant expression evaluation. 2010-04-02 11:22:41 -07:00
Eric Anholt ebbf14b980 Fix error handling of logic operators.
They were always throwing a type error because type wasn't being set.
2010-04-02 11:22:41 -07:00
Eric Anholt 183d8c6394 Emit errors for unfinished ast_to_hir expression operations. 2010-04-02 11:22:41 -07:00
Eric Anholt a5827fe8d0 Fix ast_logic_not handling to be unary, not binary. 2010-04-02 11:22:41 -07:00
Eric Anholt 65e1a7ac6a Add errors for type results of other expressions. 2010-04-02 11:22:41 -07:00
Eric Anholt a13bb1490c Emit errors from failure in arithmetic_result_type.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-04-02 11:22:35 -07:00
Eric Anholt a576f9d84c Start trying to fill in a few bits of ir_constant_expression.cpp
This makes a little progress on CorrectParse2.frag.
2010-04-02 11:05:16 -07:00
Eric Anholt 307c71bf24 Compute the constant value of a constant initializer.
Fixes constFunc.frag.
2010-04-02 11:05:16 -07:00
Eric Anholt ac3af37d27 Allow initializers of constant values to succeed.
This regresses constFunc.frag, but that's just unexpectedly passing
because of the FINISHME just above.
2010-04-02 11:05:16 -07:00
Eric Anholt 068c80cfe0 Don't create a parameter declaration for a (void) parameter.
Fixes segfaults in a shader consisting of just:

    void main(void) { }

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-04-02 11:05:16 -07:00
Ian Romanick 03d3f3ab71 Remove ast_node::type
It isn't a type (is was enum specifying the kind of node), it was
unused, and it was easily confused with actual type fields.  Kill with fire.
2010-04-02 11:05:16 -07:00
Ian Romanick b8a21cc6df Track max accessed array element, reject additional out-of-bounds accesses
For unsized arrays, we can't flag out-of-bounds accesses until the
array is redeclared with a size.  Track the maximum accessed element
and generate an error if the declaration specifies a size that would
cause that access to be out-of-bounds.

This causes the following tests to pass:

    glslparsertest/shaders/array10.frag
2010-04-01 18:35:08 -07:00
Ian Romanick 27e3cf8c0d Begin processing ast_array_index nodes
This causes the following tests to pass:

    glslparsertest/shaders/parser3.frag
    glslparsertest/shaders/varying3.frag (also generates spurious error)
2010-04-01 18:34:56 -07:00
Ian Romanick 63af4b0e99 Fix type handling in ir_dereference array dereference constructor 2010-04-01 18:02:48 -07:00
Ian Romanick a4f308f066 Allow unsized arrays to be redeclared with a size
Test glslparsertest/shaders/array11.frag now passes for the right reason.
2010-04-01 17:25:11 -07:00
Ian Romanick 00e517616b Add glsl_type::element_type and glsl_type::array_size queries
The former gets the type of elements in an array, and the later gets
the declared size, if any, of the array.
2010-04-01 17:17:34 -07:00
Kenneth Graunke ebfdef7a83 Set source locations on AST nodes so error messages print locations.
I haven't verified that these are all correct, but it's still a lot
better than not having anything.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2010-03-31 18:26:27 -07:00
Ian Romanick 92318a9479 Add ast_function::hir
ast_function::hir consists of bits pulled out of
ast_function_definition::hir.  In fact, the later uses the former to
do a lot of its processing.  Several class private data fields were
added to ast_function to facilitate communicate between the two.

This causes the following tests to pass:

    glslparsertest/shaders/CorrectModule.frag

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/function9.frag
    glslparsertest/shaders/function10.frag
2010-03-31 18:23:21 -07:00
Ian Romanick acce380a3f Fix exec_list::move_nodes_to when the source list is empty 2010-03-31 18:15:50 -07:00
Ian Romanick e29a585989 Use ir_variable::clone to copy parameters to the function body
Several other code movements were also done.  This partitions this
function into two halves.  The first half processes the prototype
part, and the second have processes the actual function definition.
The coming patch series will parition ast_function_definition::hir
into (at least) two separate functions.
2010-03-31 17:54:26 -07:00
Ian Romanick 2d394d4877 Add ir_variable::clone 2010-03-31 17:52:44 -07:00
Ian Romanick 25711a85c2 Minor cleanups in ast_function_definition::hir 2010-03-31 17:43:33 -07:00
Ian Romanick 00aa173c9c Generate array constructor calls 2010-03-31 16:48:48 -07:00
Ian Romanick 0f0ea58264 Add ir_function_signature::function_name 2010-03-31 16:44:12 -07:00
Ian Romanick a4775823b0 Make ir_function::signatures private 2010-03-31 16:40:58 -07:00
Ian Romanick 95cd6cc195 Add ir_function::iterator to iterate over function signatures 2010-03-31 16:40:26 -07:00
Ian Romanick 6a15d5b514 Use ir_function::add_signature to create link between function and signature
ir_function_signature now has a pointer back to the ir_function that owns it.
2010-03-31 16:37:10 -07:00
Ian Romanick 4ef183e51d Add glsl_type::generate_constructor_prototype
Generates a symbol table entry and the IR approximation of a prototype for a
type's constructor.  Currently only arrays are supported.
2010-03-31 16:30:56 -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 d612a127cc Move type_specifier_to_glsl_type to ast_type_specifier::glsl_type
This make is easily accessible from other modules.
2010-03-31 16:22:06 -07:00
Ian Romanick 615adcda8a More array declaration tests 2010-03-31 16:16:54 -07:00
Ian Romanick 299ed08a68 Fix big dumbness in glsl_type::get_array_instance
hash_table_insert needs to keep the key so that it compare keys on a
following hash_table_find call.  Since key was allocated on the stack,
it disappeared out from under the hash table.
2010-03-31 16:13:38 -07:00