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.
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.
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.
The statement making up a loop body, a then-statement, or an
else-statement are single nodes. If the statement is a block, the
single node will be an ast_compound_statement. There is no need to
loop at the top level when processing these statements.
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.
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 will be important to optimization passes. We don't want to
dead-code eliminate writes to out varyings, or propagate uninitialized
values of uniforms.
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.
Previously the same code was generated for a while loop and a do-while
loop. This pulls the code that generates the conditional break into a
separate method. This method is called either at the beginning or the
end depending on the loop type.
Reported-by: Kenneth Graunke <kenneth@whitecape.org>
Specifically, handle 'break' and 'continue' inside loops.
This causes the following tests to pass:
glslparsertest/shaders/break.frag
glslparsertest/shaders/continue.frag
This causes the following tests to pass:
glslparsertest/shaders/dowhile.frag
glslparsertest/shaders/while.frag
glslparsertest/shaders/while1.frag
glslparsertest/shaders/while2.frag
When an unsized array is accessed with a constant extension index this
sets a lower bound on the allowable sizes. When the unsized array
gets a size set due to a whole-array assignment, this size must be at
least as large as the implied lower bound.
This causes the following tests to pass:
glslparsertest/glsl2/array-16.vert
This causes the following tests to pass:
glslparsertest/glsl2/matrix-11.vert
glslparsertest/glsl2/matrix-12.vert
glslparsertest/shaders/CorrectParse2.vert
glslparsertest/shaders/CorrectSwizzle2.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