Commit Graph

453 Commits

Author SHA1 Message Date
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
Eric Anholt 7d21104a8b Remove dead code assignments and variable declarations.
This pass only works on assignments where the variable is never
referenced.  There is no code flow analysis, so it can't do a better
job of avoiding redundant assignments.

For now, the optimizer only does do_dead_code_unlinked(), so it won't
trim the builtin variable list or initializers outside of the scope of
functions.  This is because we don't have the visibility into other
functions that might get linked in in order to eliminate work on
global variables.
2010-04-19 15:33:52 -07:00
Eric Anholt 71df19f5ef Mark some variables as having usage beyond the shader's scope.
This will be important to optimization passes.  We don't want to
dead-code eliminate writes to out varyings, or propagate uninitialized
values of uniforms.
2010-04-19 11:13:20 -07:00
Ian Romanick 484606610e While-loops also start a new scope. 2010-04-16 16:42:43 -07:00
Eric Anholt 44b694e1f6 Avoid generating ir_if for &&, || short-circuiting with constant LHS.
It was breaking constant expression detection for constant
initializers, i.e. CorrectParse2.frag, CorrectParse2.vert.
2010-04-16 13:49:04 -07:00
Eric Anholt 0d42321ec1 Add support for inlining calls done inside of expressions. 2010-04-16 12:56:18 -07:00
Eric Anholt 4950a68bf2 Make && and || only evaluate the RHS when the LHS requires it. 2010-04-16 01:10:32 -07:00
Eric Anholt 5ba9420608 Add an ir_if simplification pass.
This is relatively simple at the moment, recognizing only constant
values, and not (for example) values that are restricted to a range
that make the branching constant.  However, it does remove 59 lines
from the printout of CorrectParse2.vert.
2010-04-14 17:05:13 -07:00
Eric Anholt 60be7626b8 Check that the return type of function definition matches its prototype.
Doesn't fix any testcases, but fixes a FINISHME.
2010-04-14 16:19:19 -07:00
Eric Anholt 1e7ec3ce12 Check that function definition parameter qualifiers match proto qualifiers.
Fixes function9.frag.
2010-04-14 16:18:19 -07:00
Eric Anholt 8558459512 Return the rvalue of a variable decl to fix while (bool b = condition) {} 2010-04-14 15:38:52 -07:00
Eric Anholt 3b8d2cd779 Fix the type of gl_FogFragCoord. 2010-04-14 15:28:01 -07:00
Eric Anholt a3fa3fbf76 Add an implementation of gentype-only clamp(). 2010-04-08 16:08:15 -07:00
Eric Anholt cc4ef154e6 Add builtin implementations of vector comparison functions.
Fixes CorrectFunction1.vert, glsl-fs-notequal.frag.
2010-04-08 15:35:34 -07:00
Eric Anholt cc49cea9ea Add support for builtin gentype mix(gentype a, gentype b)
Fixes glsl-fs-mix.frag, glsl-fs-mix-constant.frag.
2010-04-08 15:10:37 -07:00
Eric Anholt feeb43b829 Add buitlin functions for any(), all(), not(). 2010-04-08 15:02:59 -07:00
Eric Anholt 925759283a Add builtin normalize() functions.
Fixes CorrectSqizzle2.vert.
2010-04-08 14:38:32 -07:00