Ian Romanick [Thu, 1 Apr 2010 00:39:10 +0000 (17:39 -0700)]
Minor cleanups in ast_function_definition::hir
Ian Romanick [Wed, 31 Mar 2010 23:48:48 +0000 (16:48 -0700)]
Generate array constructor calls
Ian Romanick [Wed, 31 Mar 2010 23:44:12 +0000 (16:44 -0700)]
Add ir_function_signature::function_name
Ian Romanick [Wed, 31 Mar 2010 23:40:58 +0000 (16:40 -0700)]
Make ir_function::signatures private
Ian Romanick [Wed, 31 Mar 2010 23:40:26 +0000 (16:40 -0700)]
Add ir_function::iterator to iterate over function signatures
Ian Romanick [Wed, 31 Mar 2010 23:37:10 +0000 (16:37 -0700)]
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.
Ian Romanick [Wed, 31 Mar 2010 23:30:56 +0000 (16:30 -0700)]
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.
Ian Romanick [Wed, 31 Mar 2010 23:28:51 +0000 (16:28 -0700)]
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.
Ian Romanick [Wed, 31 Mar 2010 23:25:21 +0000 (16:25 -0700)]
Reject array constructor calls in GLSL 1.10
Ian Romanick [Wed, 31 Mar 2010 23:22:56 +0000 (16:22 -0700)]
Use ast_type_specifier::glsl_type to get the type of a constructor
This is the first baby step towards getting array constructors working.
Ian Romanick [Wed, 31 Mar 2010 23:22:06 +0000 (16:22 -0700)]
Move type_specifier_to_glsl_type to ast_type_specifier::glsl_type
This make is easily accessible from other modules.
Ian Romanick [Wed, 31 Mar 2010 23:16:54 +0000 (16:16 -0700)]
More array declaration tests
Ian Romanick [Wed, 31 Mar 2010 23:13:38 +0000 (16:13 -0700)]
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.
Ian Romanick [Wed, 31 Mar 2010 21:37:42 +0000 (14:37 -0700)]
glsl_type array constructor generate a real name for the type
Eric Anholt [Wed, 31 Mar 2010 19:29:33 +0000 (09:29 -1000)]
Test that const declarations include initializers.
Fixes dataType6.frag, and also array2.frag for an unexpected but valid
reason.
Ian Romanick [Wed, 31 Mar 2010 20:15:23 +0000 (13:15 -0700)]
Reject declarations with 'in' or 'out' qualifiers
'in' and 'out' can only be used in function parameter lists or at
global scope (1.30 and later). This change enforces this.
Ian Romanick [Wed, 31 Mar 2010 20:14:37 +0000 (13:14 -0700)]
Add 'in' to some parameters of the function
This goes along with the qualifier-?? tests.
Ian Romanick [Wed, 31 Mar 2010 20:13:12 +0000 (13:13 -0700)]
Add some variable declaration qualifier tests
Ian Romanick [Wed, 31 Mar 2010 20:03:56 +0000 (13:03 -0700)]
Fix comment bug and printf bug in previous commit
Ian Romanick [Wed, 31 Mar 2010 19:31:18 +0000 (12:31 -0700)]
Require that 'uniform' and 'varying' variables be declared at global scope
This causes the following tests to pass:
glslparsertest/shaders/uniform.frag
glslparsertest/shaders/varying.frag
Ian Romanick [Wed, 31 Mar 2010 19:26:03 +0000 (12:26 -0700)]
Slightly refector checks for declarations that must be at global scope
Eric Anholt [Wed, 31 Mar 2010 19:11:39 +0000 (09:11 -1000)]
Implement logical operators.
Fixes parser9.frag.
Eric Anholt [Wed, 31 Mar 2010 18:20:58 +0000 (08:20 -1000)]
Test that variable names don't use the reserved gl_ prefix.
Fixes identifier2.frag.
Eric Anholt [Wed, 31 Mar 2010 09:40:14 +0000 (23:40 -1000)]
Test that discard only appears in the fragment shader.
Fixes fragmentOnly4.vert.
Eric Anholt [Wed, 31 Mar 2010 09:37:51 +0000 (23:37 -1000)]
Test that main doesn't take any parameters.
Fixes main2.vert.
Eric Anholt [Wed, 31 Mar 2010 09:28:20 +0000 (23:28 -1000)]
Test that a non-void function returns a value.
Eric Anholt [Wed, 31 Mar 2010 09:23:16 +0000 (23:23 -1000)]
Test that a void function doesn't return a value.
Fixes function1.frag.
Eric Anholt [Wed, 31 Mar 2010 04:31:32 +0000 (18:31 -1000)]
Fix unused variable warning.
Ian Romanick [Wed, 31 Mar 2010 00:04:48 +0000 (17:04 -0700)]
Forbid array comparisons in GLSL 1.10
This causes the following tests to pass:
glslparsertest/shaders/array3.frag
Ian Romanick [Tue, 30 Mar 2010 23:59:27 +0000 (16:59 -0700)]
Begin handling array declarations
This causes the following tests to pass:
glslparsertest/shaders/array4.frag
glslparsertest/shaders/array5.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/array3.frag
Ian Romanick [Tue, 30 Mar 2010 23:58:19 +0000 (16:58 -0700)]
Implement array type handling
Since all glsl_type objects are flyweights, support is added to track all
known array types. This accounts for most of the changes.
Ian Romanick [Tue, 30 Mar 2010 23:57:29 +0000 (16:57 -0700)]
Add proper wrappers so that C++ code can use hash_table type
Ian Romanick [Tue, 30 Mar 2010 23:56:50 +0000 (16:56 -0700)]
Initial bits of constant expression evaluator
Currently only works for constants. The rest will be added later.
Ian Romanick [Tue, 30 Mar 2010 23:56:22 +0000 (16:56 -0700)]
Add some array declaration tests
Ian Romanick [Tue, 30 Mar 2010 00:40:11 +0000 (17:40 -0700)]
Arrays are not allowed as vertex shader inputs in GLSL 1.30 either
Ian Romanick [Tue, 30 Mar 2010 00:19:13 +0000 (17:19 -0700)]
Add several tests for vertex shader attributes
Ian Romanick [Tue, 30 Mar 2010 00:16:35 +0000 (17:16 -0700)]
Add some checking for vertex shader inputs / attributes
This causes the following tests to pass:
glslparsertest/shaders/attribute.vert
glslparsertest/shaders/attribute1.vert
glslparsertest/shaders/attribute2.vert
Ian Romanick [Mon, 29 Mar 2010 23:44:29 +0000 (16:44 -0700)]
Add parser support for texture rectangle types
Ian Romanick [Mon, 29 Mar 2010 23:32:55 +0000 (16:32 -0700)]
Use call-by-reference for apply_implicit_conversion
I'm not sure if this is a win or not. It makes the code in
apply_implicit_conversion more clear, but it obscures the fact that it
may change the pointers.
Ian Romanick [Mon, 29 Mar 2010 23:25:56 +0000 (16:25 -0700)]
Apply implicit conversions to ?: operator
Ian Romanick [Mon, 29 Mar 2010 23:22:38 +0000 (16:22 -0700)]
Apply implicit conversions to equality operators
Ian Romanick [Mon, 29 Mar 2010 23:20:07 +0000 (16:20 -0700)]
Apply implicit conversions to relational operators
Ian Romanick [Mon, 29 Mar 2010 23:17:56 +0000 (16:17 -0700)]
Apply implicit conversions to arithmetic operators
Ian Romanick [Mon, 29 Mar 2010 23:17:15 +0000 (16:17 -0700)]
Add glsl_type::is_array and glsl_type::is_float queries
Ian Romanick [Mon, 29 Mar 2010 22:36:02 +0000 (15:36 -0700)]
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
Ian Romanick [Mon, 29 Mar 2010 22:34:21 +0000 (15:34 -0700)]
Add tests for :? operator
Ian Romanick [Mon, 29 Mar 2010 22:33:54 +0000 (15:33 -0700)]
Implement HIR conversion for ?: operator
Ian Romanick [Mon, 29 Mar 2010 22:20:42 +0000 (15:20 -0700)]
Add generate_temporary to generate an anonymous temporary
Ian Romanick [Mon, 29 Mar 2010 22:11:05 +0000 (15:11 -0700)]
Implement HIR conversion for ast_nequal and ast_equal
The following tests now pass:
shaders/glsl-unused-varying.frag
shaders/glsl-fs-sqrt-branch.frag
Ian Romanick [Mon, 29 Mar 2010 21:15:05 +0000 (14:15 -0700)]
Add missing break-statements in ast_expression::hir
The ast_conditional case was flowing right into ast_pre_inc.
Ian Romanick [Mon, 29 Mar 2010 21:11:25 +0000 (14:11 -0700)]
Implement ir_if (for if-statments) and conversion from AST
The following tests now pass:
glslparsertest/shaders/if1.frag
glslparsertest/shaders/if2.frag
The following tests that used to pass now fail. It appears that most
of these fail because ast_nequal and ast_equal are not converted to HIR.
shaders/glsl-unused-varying.frag
shaders/glsl-fs-sqrt-branch.frag
Ian Romanick [Mon, 29 Mar 2010 21:11:10 +0000 (14:11 -0700)]
Add several simple if-statement tests
Ian Romanick [Mon, 29 Mar 2010 19:59:02 +0000 (12:59 -0700)]
Add a variable to the symbol table after processing the initializer
Ian Romanick [Mon, 29 Mar 2010 19:52:00 +0000 (12:52 -0700)]
Trivial code cleanup in ir_dereference::is_lvalue
Eric Anholt [Sun, 28 Mar 2010 08:55:38 +0000 (01:55 -0700)]
Add support for builtin radians() and degrees().
Eric Anholt [Sun, 28 Mar 2010 08:46:48 +0000 (01:46 -0700)]
Add definitions for 1.10 built-in uniforms for ff state.
Eric Anholt [Sun, 28 Mar 2010 08:29:18 +0000 (01:29 -0700)]
Don't let swizzles with duplicated components be considered as lvalues.
Fixes swizzle2.frag.
Eric Anholt [Sun, 28 Mar 2010 08:24:55 +0000 (01:24 -0700)]
Reject main() declarations with a non-void return value.
Fixes main3.vert.
Eric Anholt [Sun, 28 Mar 2010 07:56:22 +0000 (00:56 -0700)]
Reject variables marked with attribute in the fragment shader.
Fixes attribute.frag.
Eric Anholt [Sun, 28 Mar 2010 07:36:06 +0000 (00:36 -0700)]
Add the instruction for the parameter variable declarations of builtin funcs.
Matches constructor setup, but I'm not really sure why we make the
variable twice.
Eric Anholt [Sat, 27 Mar 2010 21:04:43 +0000 (14:04 -0700)]
Implement dot() builtin.
Eric Anholt [Sat, 27 Mar 2010 20:56:35 +0000 (13:56 -0700)]
Implement exp2() and log2(), and make ir_unop_exp and ir_unop_log be base e.
Making the base e functions IR operations is not a clear win. i965
doesn't support it, it doesn't look like r600 supports it, but r500
does. It should be easily supportable as a lowering pass, though.
Eric Anholt [Sat, 27 Mar 2010 20:55:04 +0000 (13:55 -0700)]
Implement builtin length() function.
Eric Anholt [Sat, 27 Mar 2010 20:01:51 +0000 (13:01 -0700)]
Add sqrt() builtin as an IR operation.
Following a discussion in #dri-devel, I think this makes more sense
than implementing it as RSQ RCP CMP as Mesa did. The i965 has a
hardware sqrt that should work, and AMD is suppposed to be able to
implement it as RSQ RCP with an alternate floating point mode so that
the 0.0 case is handled like we want.
Eric Anholt [Sat, 27 Mar 2010 19:59:42 +0000 (12:59 -0700)]
Add builtin pow() function.
Eric Anholt [Sat, 27 Mar 2010 19:48:57 +0000 (12:48 -0700)]
Add support for builtin deprecated fs varyings.
Fixes glsl-color.frag.
Eric Anholt [Sat, 27 Mar 2010 19:43:13 +0000 (12:43 -0700)]
Implement some binary gentype builtin functions.
Eric Anholt [Sat, 27 Mar 2010 19:25:20 +0000 (12:25 -0700)]
Implement additional unary gentype builtins.
Eric Anholt [Sat, 27 Mar 2010 01:20:30 +0000 (18:20 -0700)]
Implement the first builtin function: exp().
Ian Romanick [Mon, 29 Mar 2010 00:03:16 +0000 (17:03 -0700)]
Generate more correctly diagnostics from some invalid initializers
Ian Romanick [Sun, 28 Mar 2010 01:56:53 +0000 (18:56 -0700)]
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
Ian Romanick [Sat, 27 Mar 2010 01:05:27 +0000 (18:05 -0700)]
Reject uniform initializers in GLSL 1.10 mode
Now both glslparsertest/dataType3.frag and glslparsertest/dataType2.frag pass.
Eric Anholt [Fri, 26 Mar 2010 23:37:53 +0000 (16:37 -0700)]
Set variables with the sampler base type to read only.
Fixes increment3.frag.
Eric Anholt [Fri, 26 Mar 2010 23:37:22 +0000 (16:37 -0700)]
Set the var_type for arrays to error_type until it's implemented.
"Fixes" segfaults in array tests.
Eric Anholt [Fri, 26 Mar 2010 19:16:54 +0000 (12:16 -0700)]
Add support for ast_to_hir of pre inc/dec.
Eric Anholt [Fri, 26 Mar 2010 19:14:54 +0000 (12:14 -0700)]
Add support for ast_to_hir of post inc/dec.
Eric Anholt [Fri, 26 Mar 2010 22:51:45 +0000 (15:51 -0700)]
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.
Eric Anholt [Fri, 26 Mar 2010 19:07:44 +0000 (12:07 -0700)]
Add constructors for immediate hir constants.
This will make ast_to_hir for inc/dec easier.
Eric Anholt [Fri, 26 Mar 2010 18:57:46 +0000 (11:57 -0700)]
Add support for %= in ast_to_hir.
Eric Anholt [Fri, 26 Mar 2010 18:53:37 +0000 (11:53 -0700)]
Factor out assignment setup in ast_to_hir.
Eric Anholt [Fri, 26 Mar 2010 18:00:07 +0000 (11:00 -0700)]
IR print visitor: Print out something for the operator.
Ian Romanick [Sat, 27 Mar 2010 00:42:10 +0000 (17:42 -0700)]
IR print visitor: Print expressions a little better
Ian Romanick [Sat, 27 Mar 2010 00:38:58 +0000 (17:38 -0700)]
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.
Ian Romanick [Sat, 27 Mar 2010 00:30:30 +0000 (17:30 -0700)]
IR print visitor: print function calls
Ian Romanick [Sat, 27 Mar 2010 00:29:29 +0000 (17:29 -0700)]
Add hack ir_call::callee_name to get the name of the called function
Ian Romanick [Sat, 27 Mar 2010 00:28:52 +0000 (17:28 -0700)]
Be sure to set ir_function_signature::definition for constructors
Ian Romanick [Sat, 27 Mar 2010 00:19:47 +0000 (17:19 -0700)]
Add ir_call::iterator to iterate over actual parameters
Ian Romanick [Sat, 27 Mar 2010 00:17:41 +0000 (17:17 -0700)]
Add missing parenthesis in foreach_iter
This allows uses like 'foreach_iter(exec_list_iterator, iter, *list_ptr)'.
Ian Romanick [Fri, 26 Mar 2010 23:41:43 +0000 (16:41 -0700)]
Add some simple constructor tests
Ian Romanick [Fri, 26 Mar 2010 23:11:48 +0000 (16:11 -0700)]
Add unary operator to convert unsigned integer to float
Ian Romanick [Fri, 26 Mar 2010 18:43:36 +0000 (11:43 -0700)]
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.
Ian Romanick [Fri, 26 Mar 2010 18:13:43 +0000 (11:13 -0700)]
Add glsl_type::components to query total number of components in a type
Ian Romanick [Fri, 26 Mar 2010 21:41:32 +0000 (14:41 -0700)]
Replace remaining use of is_error_type with glsl_type::is_error
Ian Romanick [Fri, 26 Mar 2010 21:40:37 +0000 (14:40 -0700)]
Replace remaining uses of is_numeric_base_type with glsl_type::is_numeric
Ian Romanick [Fri, 26 Mar 2010 21:38:37 +0000 (14:38 -0700)]
Replace is_integer_base_type macro with glsl_type::is_integer method
Ian Romanick [Fri, 26 Mar 2010 21:33:41 +0000 (14:33 -0700)]
Make glsl_*_type glsl_type class static data
Ian Romanick [Fri, 26 Mar 2010 21:27:23 +0000 (14:27 -0700)]
Use glsl_type::is_error instead of comparison with glsl_error_type pointer
Kenneth Graunke [Fri, 26 Mar 2010 08:20:08 +0000 (01:20 -0700)]
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>
Kenneth Graunke [Fri, 26 Mar 2010 07:25:36 +0000 (00:25 -0700)]
Add new abstract ir_rvalue class; rework accordingly.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Kenneth Graunke [Fri, 26 Mar 2010 06:30:28 +0000 (23:30 -0700)]
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>