Age | Commit message (Collapse) | Author |
|
The code for handling implicit conversions should probably get
refactored, but for now, this is easy.
Fixes piglit test constructor-26.vert.
|
|
return_constructors
Now that constructors are not generated as functions or stored in the
symbol table, there is no need to flag whether or not constructors
should be returned.
|
|
|
|
The GLSL 1.20 spec specifically disallows this, but it was allowed in
GLSL 1.10.
Fixes piglit test cases local-function-0[13].frag and bugzilla #29921.
|
|
Previously, using bit-wise operators in some larger expression would
crash on a NULL pointer dereference. This code at least doesn't crash.
Fixes piglit test bitwise-01.frag.
|
|
|
|
Per the GLSL 1.20 specification (presumably a clarification of 1.10).
Also, when creating user functions, make a new ir_function that shadows the
built-in ir_function, rather than adding new signatures. User functions
are supposed to hide built-ins, not overload them.
Fixes piglit tests redeclaration-{04, 12, 14}.vert.
|
|
Moving the check for an earlier variable declaration helps cleanly
separate out the re-declaration vs. new declaration code a bit. With
that in place, conflicts between variable names and structure types or
function names aren't caught by the earlier "redeclaration" error
message, so check the return type on glsl_symbol_table::add_variable
and issue an error there. If one occurs, don't emit the initializer.
Fixes redeclaration-01.vert and redeclaration-09.vert.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
|
|
Instead, make a new ir_function and try to add it to the symbol table.
Fixes piglit test redeclaration-08.vert.
|
|
Instead, rely on the symbol table's rules.
Fixes redeclaration-02.vert.
|
|
As of 1.20, variable names, function names, and structure type names all
share a single namespace, and should conflict with one another in the
same scope, or hide each other in nested scopes.
However, in 1.10, variables and functions can share the same name in the
same scope. Structure types, however, conflict with/hide both.
Fixes piglit tests redeclaration-06.vert, redeclaration-11.vert,
redeclaration-19.vert, and struct-05.vert.
|
|
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
|
|
Make glsl include only main/core.h from core mesa.
|
|
This prevents assertion failures or cascading errors after we've
logged the fact that we were unable to handle the initializer.
Fixes unsized-array-non-const-index-2.vert
|
|
Bug #29608.
|
|
Fixes glsl-getactiveuniform-array-size.
|
|
The variable is actually used but only in the body of an assert.
|
|
The 'vec4[12] foo' style already worked, but the 'vec4 foo[12]' style
did not. Also, 'vec4[] foo' was wrongly accepted.
Fixes piglit test cases array-19.vert and array-21.vert.
May fix fd.o bug #29684 (or at least part of it).
|
|
Fixes piglit test redeclaration-03.vert.
|
|
The code would attempt to add a new signature to the ir_function, which
didn't exist. Simply bailing out/returning early seems reasonable.
Fixes piglit test redeclaration-02.vert, and fixes a crash in
redeclaration-03.vert (the test still fails).
|
|
Fixes glslparsertest/glsl2/scoping-01.frag (successfully compiled but
should've failed) and scoping-02.frag (assertion triggered).
|
|
In C++ you don't have to say 'struct' or 'class' if the declaration of
the type has been seen. Some compilers will complain if you use
'struct' when 'class' should have been used and vice versa.
Fixes bugzilla #29539.
|
|
Accidentally having a variable called 'sig' within an if-statement
cause the higher scope 'sig' to always be NULL. As a result a new
function signature was created for a function definition even when one
already existed from a prototype declaration.
Fixes piglit test case glsl-function-prototype (bugzilla #29520).
|
|
Fixes use-before-decl in glslparsertest shaders.
Fixes:
CorrectFull.frag
CorrectModule.frag
|
|
I introduced this for ir_dead_code to distinguish function parameter
outvals from varying outputs. Only, since ast_to_hir's
current_function is unset when setting up function parameters (they're
needed for making the function signature in the first place), all
function parameter outvals were marked as shader outputs anyway. This
meant that an inlined function's cloned outval was marked as a shader
output and couldn't be dead-code eliminated. Instead, since
ir_dead_code doesn't even look at function parameters, just use
var->mode.
The longest Mesa IR coming out of ir_to_mesa for Yo Frankie drops from
725 instructions to 636.
|
|
|
|
In most cases, we needed to be reparenting the cloned IR to a
different context (for example, to the linked shader instead of the
unlinked shader), or optimization before the reparent would cause
memory usage of the original object to grow and grow.
|
|
|
|
|
|
Fixes:
glsl-arb-fragment-coord-conventions
|
|
The rest cannot be handled until built-in variables (i.e.,
gl_FragCoord) can be redeclared to add qualifiers.
|
|
Kind of missing the point to only do the side effects if the LHS
evaluates as true.
Fixes:
glsl1-|| operator, short-circuit
|
|
|
|
Previously, the compiler expected the result of the multiplication to
be of the same type as the vector. This is correct for square
matrices, but wrong for all others.
We fix this by instead expecting a vector with the same number of rows
as the matrix (for the case of M*v with a column vector) or the same
number of columns as the matrix (for v*M with a row vector).
This fix causes the following four glean tests to now pass:
glsl1-mat4x2 * vec4
glsl1-vec2 * mat4x2 multiply
glsl1-vec3 * mat4x3 multiply
glsl1-vec4 * mat3x4 multiply
|
|
Fixes:
glsl1-for-loop with continue
Bug #29097
|
|
Implicit conversions were not being performed, nor was there any
type checking - it was possible to have, say, var->type == float
and var->constant_value->type == int. Later use of the constant
expression would trigger an assertion.
Fixes piglit test const-implicit-conversion.frag.
|
|
Previously, any occurence of the unary plus operator would trigger a
bogus type mismatch error. Fix this by making the ast_plus case look
more like the ast_neg case as far as type-checking is concerned.
With this change the shaders/CorrectPreprocess8.frag test in piglit
now passes.
|
|
|
|
This is quite a large patch because breaking it into smaller pieces
would result in the tree being intermitently broken. The big changes
are:
* Add the ir_var_temporary variable mode
* Change the ir_variable constructor to take the mode as a
parameter and correctly specify the mode for all ir_varables.
* Change the linker to not cross validate ir_var_temporary
variables.
* Change the linker to pull all ir_var_temporary variables from
global scope into 'main'.
|
|
Since the types are singletons across the lifetime of the compiler,
repeatedly compiling a program with the same structure type defined
would drop a copy of the array on the floor per compile.
This is a bit tricky because the static GLSL types are not called with
the talloc-based new, so we have to use the global type context, which
may not be initialized yet.
|
|
Fixes piglit test unsized-array-non-const-index.vert.
|
|
|
|
Temporary variables added for &&, ||, and ?: were not being added to
the instruction stream. This resulted in either test failures or
Valgrind being angry after the original IR tree was destroyed by
talloc_free. The talloc_free caused the ir_variables to be destroyed
even though they were still referenced.
|
|
Most places in the code simply use a static name, which works because
names are never used to look up an ir_variable. generate_temporary is
simply unnecessary (and looks like it would leak memory, and isn't
thread safe...)
|
|
|
|
|
|
initializer."
This change causes segfaults in other tests. A fix for both sets of
segfaults is coming.
This reverts commit d4d630b72c7b7f38074addda0f1b819608247d93.
|
|
This fixes a regression in the generated code from when I did the
ir_validate.cpp-driven rework of assignments.
|
|
This is as opposed to returning the type of the base class of the hierarchy.
|
|
|