Kenneth Graunke
32b305207c
ir_reader: Add initial loop support; doesn't yet support break/continue.
2010-04-28 18:14:54 -07:00
Kenneth Graunke
451381c220
ir_reader: Add support for reading (var_ref ...) and (array_ref ...)
2010-04-28 18:14:54 -07:00
Kenneth Graunke
46ef8f19d7
ir_reader: rvalues are instructions too!
2010-04-28 18:14:54 -07:00
Kenneth Graunke
3ea0582803
ir_reader: Add support for reading conditionals: (if ...)
2010-04-28 18:14:54 -07:00
Kenneth Graunke
5794497542
ir_reader: Add support for reading array types.
...
Also, constify glsl_type pointers; this was necessary to use
glsl_type::get_array_instance.
2010-04-28 18:14:54 -07:00
Kenneth Graunke
9d2ff7617a
ir_reader: Add support for reading (return ...)
2010-04-28 18:14:54 -07:00
Kenneth Graunke
d1d2ada3c6
ir_reader: Add support for reading variable declarations.
...
It also now reads a list of instructions, as it should, rather than a
single rvalue.
2010-04-28 18:14:54 -07:00
Kenneth Graunke
f955649af3
Partial IR reader.
...
Currently reads assignments, constants, expressions, and swizzles.
2010-04-28 18:14:53 -07:00
Kenneth Graunke
e8b399270d
Set language_version to 130 (the max currently supported) when reading IR.
...
This is necessary so _mesa_glsl_initialize_types can create appropriate
glsl_types and add them to the symbol table.
In the future, we'll want to set it to the max GLSL version supported by
the current driver.
2010-04-28 18:14:53 -07:00
Kenneth Graunke
34350be2cd
Add stub ir_reader and new 'i' mode for reading IR rather than GLSL.
2010-04-28 18:14:53 -07:00
Kenneth Graunke
1bfe1c3fdd
Add a simple S-Expression reader and printer.
2010-04-28 18:14:36 -07:00
Kenneth Graunke
9d290d786d
Use "neg" when printing/reading unary negation rather than "-".
...
"-" is now only used for binary subtraction.
2010-04-28 15:42:07 -07:00
Kenneth Graunke
3b96996b7e
Move array of operator strings out of ir_print_visitor.cpp.
...
Also implement a reverse-lookup function for use in the IR reader.
2010-04-28 15:42:07 -07:00
Kenneth Graunke
bff6013d46
Factor out parameter list replacement for later reuse.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
0d605cb97c
Factor out parameter list matching from ast_function::hir for later reuse.
...
Unfortunately, we still have two kinds of matching - one, with implicit
conversions (for use in calls) and another without them (for finding a
prototype to overwrite when processing a function body). This commit
does not attempt to coalesce the two.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
abd40b1521
Factor out qualifier checking code for later reuse.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
0e385196f6
ir_print_visitor: Re-parenthesize ir_call output.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
dde9678162
ir_print_visitor: Print return type of ir_function_signatures.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
405e122a47
ir_print_visitor: Print (constant bool (1)) instead of "true"
...
It might be better to simply handle "true" in the reader, but since
booleans normally aren't printed as "true" or "false", we may as well go
for consistency.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
2bc582d265
ir_print_visitor: Remove unnecessary parens around expression operands.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
668d0a992a
ir_print_visitor: Remove unnecessary parens around array size in types.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
aecdefa8c0
ir_print_visitor: Fix unclosed parenthesis in (call...
2010-04-28 15:34:52 -07:00
Kenneth Graunke
c84f636c97
ir_print_visitor: Fix unclosed parenthesis in (assign ...
...
Also remove useless parens around subexpressions.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
a02c5afce8
Add parens around printed IR so it's an official list of instructions.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
1168d95109
ir_print_visitor: Remove unnecessary parenthesis around variable names.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
7dd6adbe2e
Refactor ir_expression::get_num_operands.
...
A new static version takes an ir_expression_operation enum, and the
original non-static version now uses it. This will make it easier to
read operations (where the ir_expression doesn't yet exist).
2010-04-28 15:34:52 -07:00
Kenneth Graunke
1a3a096bf5
ir_print_visitor: print the type of expressions.
...
This can be useful for debugging - it allows us to see that the inferred
type is what we think it should be. Furthermore, it will allow the IR
reader to avoid complex, operator-specific type inference.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
295bb7ff8d
ir_print_visitor: Remove unnecessary parenthesis around type names.
...
Parenthesis should only be present for compound types (i.e. arrays
or structures). For atomic types, simply print the symbol.
2010-04-28 15:34:52 -07:00
Kenneth Graunke
1f0cb24f8b
Print full type for ir_constant instead of base and component count.
...
vec4 and mat2x2 have the same base type and number of components;
printing the full type allows us to distinguish the two.
2010-04-28 15:34:52 -07:00
Ian Romanick
3eba593f35
Implement gl_TextureMatrix built-in uniform
2010-04-26 14:59:32 -07:00
Ian Romanick
230ade93a6
Make private glsl_type singletons public
2010-04-26 14:59:16 -07:00
Ian Romanick
c11f1a4fb0
Initial implementation of #line
...
Does not handle comments in #line or line continuation characters, but
it should be good enough for now.
2010-04-26 14:19:49 -07:00
Eric Anholt
25ebc0459f
builtin_functions: Clean up compiler warning about unused name, instructions.
2010-04-23 16:12:44 -07:00
Eric Anholt
d7f6f346be
De-obfuscate some of builtin_types.h.
2010-04-23 16:12:44 -07:00
Eric Anholt
e8e9748722
ir_function_inlining: Implement inlining in many more cases.
...
We still don't inline for control flow in the inlined function, and we
don't have any limits on what we will inline.
2010-04-23 16:12:44 -07:00
Eric Anholt
ec9e73870c
Put static pointers to vec[234]_types along with the static float_type.
...
Otherwise you have to type a lot of get_instance.
2010-04-23 16:12:44 -07:00
Eric Anholt
8d3e59f1f3
Replace builtin_types.h generation with the generated output.
...
The script to generate it was longer and more obfuscated than the output.
2010-04-23 16:12:44 -07:00
Eric Anholt
82ad90f8cf
Fix the swizzling of vector constructors from scalars.
...
A refactor turned 'i' into '1', meaning everything writemasked into
the y component.
2010-04-23 16:12:44 -07:00
Eric Anholt
22147be898
ir_function_inlining: Avoid NULL dereference on assignment conditions.
2010-04-23 16:12:44 -07:00
Ian Romanick
6aeada7966
Zero-out the entire parser state structure at initialization
...
Among other things, this ensures that all of the extension flags are
initially disabled.
This causes the following tests to pass:
glslparsertest/glsl2/draw_buffers-02.frag
2010-04-23 13:37:47 -07:00
Ian Romanick
eb56cea3b3
Add missing 'else's to fix extension processing
...
The missing else-statements caused all of the extensions execpt
GL_ARB_texture_rectangle to be unsupported.
This causes the following tests to pass:
glslparsertest/glsl2/draw_buffers-04.frag
2010-04-23 13:32:23 -07:00
Kenneth Graunke
25851a8d87
Fix illegal (var_ref (array_ref ...)) in matrix constructors.
2010-04-22 00:25:55 -07:00
Kenneth Graunke
67029b13b7
Actually emit temp declaration in vector comparison builtins.
2010-04-21 23:58:13 -07:00
Kenneth Graunke
6202cbfe36
Fix ir_dead_code for function refactoring.
2010-04-21 16:02:15 -07:00
Kenneth Graunke
7bcd5bedcc
Emit body for constructors in the right place.
...
Previously, the body of some vector constructors were added to the wrong
function signature, and the body of matrix constructors were just being
dumped in the main instruction stream.
2010-04-21 15:37:10 -07:00
Kenneth Graunke
3289886688
Remove ir_label since it is no longer used.
2010-04-21 15:37:10 -07:00
Kenneth Graunke
9fa99f3b6c
Refactor IR function representation.
...
Now, ir_function is emitted as part of the IR instructions, rather than
simply existing in the symbol table. Individual ir_function_signatures
are not emitted themselves, but only as part of ir_function.
2010-04-21 15:36:36 -07:00
Kenneth Graunke
f96c52ba2e
Use ir_function_signature::function_name() rather than direct access.
2010-04-21 15:36:36 -07:00
Kenneth Graunke
67a092ae09
Ensure that both parameter lists are the same length in function overloading.
...
Fixes new test function-05.glsl, where the second function has matching
parameter types, but less of them.
2010-04-21 15:36:36 -07:00
Ian Romanick
ff236fa9b6
Add missing break statement
2010-04-21 15:08:08 -07:00