Commit Graph

51 Commits

Author SHA1 Message Date
Eric Anholt c22c40015d Implement the first builtin function: exp(). 2010-03-29 12:48:45 -07:00
Ian Romanick 43de172820 Generate more correctly diagnostics from some invalid initializers 2010-03-28 17:03:16 -07:00
Ian Romanick 66faec4895 Initial bits to process initializers in variable declarations
As a result, the following tests pass:

    glslparsertest/array3.frag
    glslparsertest/CGStandardLibrary.frag
    glslparsertest/ConstantConversions.frag
    glslparsertest/constructor1.frag
    glslparsertest/constructor2.frag
    glslparsertest/constructor3.V110.frag
    glslparsertest/dataType4.frag
    glslparsertest/dataType5.frag
    glslparsertest/dataType13.frag
    glslparsertest/dataType19.frag
    glslparsertest/matrix.V110.frag
    glslparsertest/parser7.frag
    glslparsertest/swizzle3.frag

The following tests also pass, but it is just by dumb luck.  In these
cases the shader fails to compile, but it fails for the wrong reason:

    glslparsertest/array6.frag
    glslparsertest/comma2.frag
    glslparsertest/conditional1.frag
    glslparsertest/conditional2.frag
    glslparsertest/conditional3.frag
    glslparsertest/constFunc.frag
    glslparsertest/ParseTest3.frag
    glslparsertest/ParseTest4.frag
    glslparsertest/varying3.frag
    glslparsertest/parser8.frag (also segfaults)
    glslparsertest/parser9.frag (also segfaults)

The following tests now fail.  As far as I can tell, these are all
cases where the shader was failing to compile, but it was failing for
the wrong reason.

    glslparsertest/CorrectMatComma.frag
    glslparsertest/CorrectModule.frag
    glslparsertest/CorrectSwizzle2.vert
    glslparsertest/shaders/glsl-fs-bug25902.frag
2010-03-27 18:56:53 -07:00
Ian Romanick 19360152f5 Reject uniform initializers in GLSL 1.10 mode
Now both glslparsertest/dataType3.frag and glslparsertest/dataType2.frag pass.
2010-03-26 18:05:27 -07:00
Eric Anholt 8518e75d28 Set the var_type for arrays to error_type until it's implemented.
"Fixes" segfaults in array tests.
2010-03-26 17:51:41 -07:00
Eric Anholt 76ea56c007 Add support for ast_to_hir of pre inc/dec. 2010-03-26 17:51:41 -07:00
Eric Anholt de38f0ed53 Add support for ast_to_hir of post inc/dec. 2010-03-26 17:51:41 -07:00
Eric Anholt 48a0e64b7d Add support for %= in ast_to_hir. 2010-03-26 17:51:41 -07:00
Eric Anholt 10a6852186 Factor out assignment setup in ast_to_hir. 2010-03-26 17:51:40 -07:00
Ian Romanick cef3baecf6 Replace remaining use of is_error_type with glsl_type::is_error 2010-03-26 14:41:32 -07:00
Ian Romanick a6d653dcbb Replace remaining uses of is_numeric_base_type with glsl_type::is_numeric 2010-03-26 14:40:37 -07:00
Ian Romanick 40176e249f Replace is_integer_base_type macro with glsl_type::is_integer method 2010-03-26 14:38:37 -07:00
Ian Romanick 0471e8b089 Make glsl_*_type glsl_type class static data 2010-03-26 14:33:41 -07:00
Ian Romanick a43817a483 Use glsl_type::is_error instead of comparison with glsl_error_type pointer 2010-03-26 14:27:23 -07:00
Kenneth Graunke affc1413ac Move swizzles out of ir_dereference and into their own class.
Also turn generate_swizzle into a static "create" method of the new
class; we'll want to use it for the IR reader as well.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-03-26 14:00:59 -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
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
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 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 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 d2b6bc651a Use glsl_type::get_instance instead of symbol table look-up 2010-03-24 17:45:14 -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 882dad7540 ir_function constructor now takes the function name as a parameter 2010-03-23 17:42:04 -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
Ian Romanick cec65a6b76 Generate an error for variables declared with type void 2010-03-23 12:28:44 -07:00
Ian Romanick e39cc69fa3 Set, and require, a return type for function signatures 2010-03-23 12:19:13 -07:00
Ian Romanick 41ec6a47ab Track the function that is currently being defined
Later this will allow type checking for return statements.
2010-03-19 17:08:05 -07:00
Ian Romanick 16a246c049 Initial bits for converting AST return nodes to IR return instructions 2010-03-19 16:51:16 -07:00
Ian Romanick 3359e58eac Use glsl_symbol_table::name_declared_this_scope
Prevent most illegal name reuse.
2010-03-19 15:38:52 -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 7f9d309743 Ensure that ast_type always has type_name set
For built-in types, type_name would be NULL.  This ensures that
type_name is set even for the built-in types.  This simplifies code in
a few places and centralizes the name setting code.
2010-03-15 14:18:32 -07:00
Ian Romanick 548fa293a3 Move ast_function_expression::hir to ast_function.cpp 2010-03-15 13:04:13 -07:00
Ian Romanick 471471f834 Initial pass at resolving function calls
The code is still really rough and *REALLY* incomplete.  This at least
passes the first few trivially simple test cases.
2010-03-11 14:57:26 -08:00
Ian Romanick cdb8d54b68 Default function parameters to 'in' instead of auto 2010-03-11 14:48:51 -08:00
Ian Romanick ed45ec6a51 Add ir_call call to represent function calls. 2010-03-11 14:35:37 -08:00
Ian Romanick 7cfddf1941 Make ast_function_expression subclass of ast_expression 2010-03-10 13:26:52 -08:00
Ian Romanick adfb0cd740 IR variable: Initial work to support GLSL built-in variables 2010-03-10 10:43:54 -08:00
Ian Romanick d949a9afb0 Move top-level AST to HIR conversion to _mesa_ast_to_hir 2010-03-10 09:55:22 -08:00
Ian Romanick 0b67823462 AST to IR: Mark 'varying' in a vertex shader as 'out' 2010-03-10 00:28:59 -08:00
Ian Romanick 6652af36fe Add assignment side-effect to the instruction stream
The actual assignment is a side-effect of the assignment expression.
Add it to the instruction stream and return the LHS of the assignment
as its rvalue.
2010-03-09 16:38:02 -08:00
Ian Romanick fce1150156 Convert is_glsl_type_matrix to glsl_type::is_matrix 2010-03-09 15:58:52 -08:00
Ian Romanick a2dd22fb19 Convert is_glsl_type_vector to glsl_type::is_vector 2010-03-09 15:55:16 -08:00
Ian Romanick cb36f8aaee Convert is_glsl_type_scalar to glsl_type::is_scalar 2010-03-09 15:51:22 -08:00
Ian Romanick 3a9e989628 Remove unused function 2010-03-08 23:44:59 -08:00
Ian Romanick 0044e7edce Conver IR structures to use exec_list instead of simple_node 2010-03-08 23:44:54 -08:00
Ian Romanick 18238de6c3 Make AST->HIR conversion a method of ast_node, re-enable 2010-03-01 13:49:10 -08:00