Initial bits to process initializers in variable declarations
As a result, the following tests pass:
glslparsertest/array3.frag
glslparsertest/CGStandardLibrary.frag
glslparsertest/ConstantConversions.frag
glslparsertest/constructor1.frag
glslparsertest/constructor2.frag
glslparsertest/constructor3.V110.frag
glslparsertest/dataType4.frag
glslparsertest/dataType5.frag
glslparsertest/dataType13.frag
glslparsertest/dataType19.frag
glslparsertest/matrix.V110.frag
glslparsertest/parser7.frag
glslparsertest/swizzle3.frag
The following tests also pass, but it is just by dumb luck. In these
cases the shader fails to compile, but it fails for the wrong reason:
glslparsertest/array6.frag
glslparsertest/comma2.frag
glslparsertest/conditional1.frag
glslparsertest/conditional2.frag
glslparsertest/conditional3.frag
glslparsertest/constFunc.frag
glslparsertest/ParseTest3.frag
glslparsertest/ParseTest4.frag
glslparsertest/varying3.frag
glslparsertest/parser8.frag (also segfaults)
glslparsertest/parser9.frag (also segfaults)
The following tests now fail. As far as I can tell, these are all
cases where the shader was failing to compile, but it was failing for
the wrong reason.
glslparsertest/CorrectMatComma.frag
glslparsertest/CorrectModule.frag
glslparsertest/CorrectSwizzle2.vert
glslparsertest/shaders/glsl-fs-bug25902.frag
This commit is contained in:
+25
-14
@@ -980,22 +980,33 @@ ast_declarator_list::hir(exec_list *instructions,
|
||||
|
||||
instructions->push_tail(var);
|
||||
|
||||
/* From page 24 (page 30 of the PDF) of the GLSL 1.10 spec:
|
||||
*
|
||||
* "All uniform variables are read-only and are initialized either
|
||||
* directly by an application via API commands, or indirectly by
|
||||
* OpenGL."
|
||||
*/
|
||||
if ((state->language_version <= 110)
|
||||
&& (var->mode == ir_var_uniform)
|
||||
&& (decl->initializer != NULL)) {
|
||||
YYLTYPE loc = decl->initializer->get_location();
|
||||
if (decl->initializer != NULL) {
|
||||
/* From page 24 (page 30 of the PDF) of the GLSL 1.10 spec:
|
||||
*
|
||||
* "All uniform variables are read-only and are initialized either
|
||||
* directly by an application via API commands, or indirectly by
|
||||
* OpenGL."
|
||||
*/
|
||||
if ((state->language_version <= 110)
|
||||
&& (var->mode == ir_var_uniform)) {
|
||||
YYLTYPE loc = decl->initializer->get_location();
|
||||
|
||||
_mesa_glsl_error(& loc, state, "uniform initializers forbidden in "
|
||||
"GLSL 1.10");
|
||||
_mesa_glsl_error(& loc, state, "uniform initializers forbidden in "
|
||||
"GLSL 1.10");
|
||||
}
|
||||
|
||||
ir_dereference *const lhs = new ir_dereference(var);
|
||||
ir_rvalue *const rhs = decl->initializer->hir(instructions, state);
|
||||
|
||||
/* FINISHME: If the declaration is either 'const' or 'uniform', the
|
||||
* FINISHME: initializer (rhs) must be a constant expression.
|
||||
*/
|
||||
|
||||
if (!rhs->type->is_error()) {
|
||||
(void) do_assignment(instructions, state, lhs, rhs,
|
||||
this->get_location());
|
||||
}
|
||||
}
|
||||
|
||||
/* FINISHME: Process the declaration initializer. */
|
||||
}
|
||||
|
||||
/* Variable declarations do not have r-values.
|
||||
|
||||
Reference in New Issue
Block a user