Module: Mesa Branch: master Commit: f09c229cc6db838ae595fb57f5e6386a035bdf42 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f09c229cc6db838ae595fb57f5e6386a035bdf42
Author: Iago Toral Quiroga <[email protected]> Date: Wed Oct 7 09:21:36 2015 +0200 glsl: shader outputs cannot have initializers GLSL Spec 4.20.8, 4.3 Storage Qualifiers: "Initializers in global declarations may only be used in declarations of global variables with no storage qualifier, with a const qualifier or with a uniform qualifier." We do this for input variables, but not for output variables. AMD and NVIDIA proprietary drivers don't allow this either. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Matt Turner <[email protected]> --- src/glsl/ast_to_hir.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 9511440..2aea5ae 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3201,6 +3201,12 @@ process_initializer(ir_variable *var, ast_declaration *decl, ? "attribute" : "varying"); } + if (var->data.mode == ir_var_shader_out && state->current_function == NULL) { + _mesa_glsl_error(&initializer_loc, state, + "cannot initialize %s shader output", + _mesa_shader_stage_to_string(state->stage)); + } + /* If the initializer is an ast_aggregate_initializer, recursively store * type information from the LHS into it, so that its hir() function can do * type checking. _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
