Age | Commit message (Collapse) | Author |
|
This should remove the burden of handling constant vector indexing
well from backend codegen, and could help with swizzle optimizations.
|
|
|
|
|
|
|
|
Move the accept method for visitors from ir_dereference to the derived
classes.
|
|
Move the accept method for hierarchical visitors from ir_dereference
to the derived classes. This was mostly straight-forward, but I
suspect that ir_dead_code_local may be broken now.
|
|
Create separate subclasses of ir_dereference for variable, array, and
record dereferences. As a side effect, array and record dereferences
no longer point to ir_variable objects directly. Instead they each
point to an ir_dereference_variable object.
This is the first of several steps in the refactoring process. The
intention is that ir_dereference will eventually become an abstract
base class.
|
|
This type of visitor should eventually replace all or almost all
current uses of ir_visitor.
|
|
|
|
|
|
|
|
This is pretty basic. Right now it only handles pure assignments --
same type on each side, no swizzling, and only within basic blocks.
|
|
Debugging this took forever as I only looked at constructors in ir.cpp
to find who wasn't setting up ->type. I dislike hiding code (as
opposed to prototypes and definitions) in C++ header files, but in
this case I have only myself to blame.
|
|
|
|
Also implement a reverse-lookup function for use in the IR reader.
|
|
|
|
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.
|
|
|
|
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).
|
|
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
|
|
This will let us know the length of function bodies for the purpose of
inlining (among other uses).
|
|
|
|
Using '#extension foo: warn' instructs the compiler to generate a
warning when some feature of the extension 'foo' is used. This patch
adds some infrastructure needed to support that for variables.
Similar changes will be needed for types and built-in functions.
|
|
|
|
|
|
This touches a lot of files because everything derived from ir_visitor
has to be updated. This is the primary disadvantage of the visitor pattern.
|
|
|
|
Fixes CorrectParse1.frag and makes for a ton of folding in
CorrectParse2.frag.
|
|
In GLSL 1.10 this was not allowed, but in GLSL 1.20 and later it is.
This causes the following tests to pass:
glslparsertest/glsl2/array-09.vert
glslparsertest/glsl2/array-13.vert
|
|
Fixes constructor-09.glsl and CorrectParse2.frag.
|
|
|
|
Fixes glsl-vs-arrays.vert and glsl-vs-mov-after-deref.vert.
Regresses parser3.frag which was failing for the wrong reason.
|
|
|
|
|
|
For unsized arrays, we can't flag out-of-bounds accesses until the
array is redeclared with a size. Track the maximum accessed element
and generate an error if the declaration specifies a size that would
cause that access to be out-of-bounds.
This causes the following tests to pass:
glslparsertest/shaders/array10.frag
|
|
|
|
|
|
|
|
|
|
ir_function_signature now has a pointer back to the ir_function that owns it.
|
|
Currently only works for constants. The rest will be added later.
|
|
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
|
|
|