Commit graph

200 commits

Author SHA1 Message Date
Eric Anholt
bfe380a721 Implement some binary gentype builtin functions. 2010-03-29 12:48:45 -07:00
Eric Anholt
2eec73f735 Implement additional unary gentype builtins. 2010-03-29 12:48:45 -07:00
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
72fc47f0b0 Set variables with the sampler base type to read only.
Fixes increment3.frag.
2010-03-26 17:51:41 -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
c4f86d3b80 Make read-only variables not be considered lvalues.
This should fix tests trying to assign to builtin "in" variables, and
will also be relied on for post_inc/dec handling.
2010-03-26 17:51:41 -07:00
Eric Anholt
3c36b2df7c Add constructors for immediate hir constants.
This will make ast_to_hir for inc/dec easier.
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
Eric Anholt
e65e12fdbc IR print visitor: Print out something for the operator. 2010-03-26 17:51:40 -07:00
Ian Romanick
d1dfe8b994 IR print visitor: Print expressions a little better 2010-03-26 17:42:10 -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
Ian Romanick
5508129fd8 IR print visitor: print function calls 2010-03-26 17:30:30 -07:00
Ian Romanick
93614bc4b9 Add hack ir_call::callee_name to get the name of the called function 2010-03-26 17:29:29 -07:00
Ian Romanick
9f93d24050 Be sure to set ir_function_signature::definition for constructors 2010-03-26 17:28:52 -07:00
Ian Romanick
9878c6518f Add ir_call::iterator to iterate over actual parameters 2010-03-26 17:20:31 -07:00
Ian Romanick
605ff69b0d Add missing parenthesis in foreach_iter
This allows uses like 'foreach_iter(exec_list_iterator, iter, *list_ptr)'.
2010-03-26 17:17:41 -07:00
Ian Romanick
8343550b42 Add some simple constructor tests 2010-03-26 16:47:06 -07:00
Ian Romanick
6c86ea8adc Add unary operator to convert unsigned integer to float 2010-03-26 16:11:48 -07:00
Ian Romanick
738c183cc9 Slightly change the representation of numeric types
For numeric types, vector_elements and matrix_columns must be at least
1.  Previously matrix_columns was 0 for vectors, and both were 0 for
scalars.  This change simplifies things in some places.
2010-03-26 14:43:16 -07:00
Ian Romanick
d811d47609 Add glsl_type::components to query total number of components in a type 2010-03-26 14:43:11 -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
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