Commit Graph

391 Commits

Author SHA1 Message Date
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
Eric Anholt 2a7b2b22f4 Repeat the optimization passes until we stop making progress. 2010-04-08 13:43:56 -07:00
Eric Anholt 6192434ac3 Add inlining support for array dereferences. 2010-04-08 13:42:41 -07:00
Eric Anholt cad9766118 Inline functions consisting of a return of an expression. 2010-04-08 11:24:06 -07:00
Ian Romanick b427c917ce Remove extraneous base-class constructor calls 2010-04-07 18:03:50 -07:00
Eric Anholt fbc7c0b8f2 Make function bodies rely on the parameter variable declarations.
Previously, generating inlined function bodies was going to be
difficult, as there was no mapping between the body's declaration of
variables where parameter values were supposed to live and the
parameter variables that a caller would use in paramater setup.
Presumably this also have been a problem for actual codegen.
2010-04-07 17:23:23 -07:00
Eric Anholt 6173312d84 Make dot() take the right number of args. 2010-04-07 17:23:23 -07:00
Eric Anholt 7e78e07ddb Fix the returns of builtin functions to actually return. 2010-04-07 17:23:23 -07:00
Eric Anholt 894ea972a4 Put function bodies under function signatures, instead of flat in the parent.
This will let us know the length of function bodies for the purpose of
inlining (among other uses).
2010-04-07 17:23:23 -07:00
Eric Anholt f1ddca9f21 Clarify the types of various exec_list in ir.h 2010-04-07 17:23:23 -07:00
Ian Romanick 0c82465395 Treat texture rectangles as an extension that is enabled be default 2010-04-07 17:13:44 -07:00
Ian Romanick c77b257094 Add support for GL_ARB_draw_buffers extension 2010-04-07 16:59:46 -07:00
Ian Romanick 887a8b07de Clean up error reporting in _mesa_glsl_process_extension 2010-04-07 16:57:56 -07:00