This causes the following tests to pass:
glslparsertest/glsl2/precision-02.vert
glslparsertest/glsl2/precision-04.vert
glslparsertest/glsl2/precision-06.vert
This causes the following test to fail. This shader was previously
failing to compile, but it was failing for the wrong reasons.
glslparsertest/glsl2/precision-03.vert
Some valid shaders, such as 'precision highp float;', evaluate to
empty sets of instructions. This causes some of the optimization
stages to enter infinite loops. Instead, don't bother processing the
empty ones.
ir_dereference_array::array is always an r-value. If the dereference
is of a varaible, that r-value will be an ir_dereference_variable.
This simplifies the code a bit.
We were nicely constructing a new expression for the implicit type
conversion, but then checking that the previous types matched instead
of the new expression's type. Fixes errors in Regnum Online shaders.
This removes a bunch of gratuitous moving around of constant values
from constructors. Makes a shader ir I was looking at for structure
handling almost readable.
Similar to other situations where the visitor pattern doesn't fit, in
this case we need the pointer to the base instruction in the
instruction stream for where to insert any new instructions we
generate (not the instruction in the tree we're looking at). By
removing the code for setting the base_ir, flattened expressions would
end up, for example, before the function definition where they had appeared.
Previously, the syntax was (array_ref <variable name> <index>), but the
subject is now a general rvalue (not a name). In particular, it might
be a (var_ref ...).
Also, remove "expected ... or (swiz)" from error messages; swiz is not
allowed inside a var_ref.
Array dereferences now point to variable dereferences instead of
pointing directly to variables. This necessitated some changes to the
way the variable is accessed when setting the maximum index array element.
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 has the added advantage that it will stop traversing the tree as
soon as the first call is found.
The output of all test cases was verified to be the same using diff.