diff options
Diffstat (limited to 'src')
31 files changed, 205 insertions, 193 deletions
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index dc7a58bf276..26f72cf8e95 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -132,12 +132,13 @@ verify_parameter_modes(_mesa_glsl_parse_state *state, } /* Verify that 'out' and 'inout' actual parameters are lvalues. */ - if (formal->mode == ir_var_out || formal->mode == ir_var_inout) { + if (formal->mode == ir_var_function_out + || formal->mode == ir_var_function_inout) { const char *mode = NULL; switch (formal->mode) { - case ir_var_out: mode = "out"; break; - case ir_var_inout: mode = "inout"; break; - default: assert(false); break; + case ir_var_function_out: mode = "out"; break; + case ir_var_function_inout: mode = "inout"; break; + default: assert(false); break; } /* This AST-based check catches errors like f(i++). The IR-based @@ -210,13 +211,13 @@ generate_call(exec_list *instructions, ir_function_signature *sig, if (formal->type->is_numeric() || formal->type->is_boolean()) { switch (formal->mode) { case ir_var_const_in: - case ir_var_in: { + case ir_var_function_in: { ir_rvalue *converted = convert_component(actual, formal->type); actual->replace_with(converted); break; } - case ir_var_out: + case ir_var_function_out: if (actual->type != formal->type) { /* To convert an out parameter, we need to create a * temporary variable to hold the value before conversion, @@ -254,7 +255,7 @@ generate_call(exec_list *instructions, ir_function_signature *sig, actual->replace_with(deref_tmp_2); } break; - case ir_var_inout: + case ir_var_function_inout: /* Inout parameters should never require conversion, since that * would require an implicit conversion to exist both to and * from the formal parameter type, and there are no diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index de3ce902e0d..3c2ce15389a 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1924,11 +1924,11 @@ is_varying_var(ir_variable *var, _mesa_glsl_parser_targets target) { switch (target) { case vertex_shader: - return var->mode == ir_var_out; + return var->mode == ir_var_shader_out; case fragment_shader: - return var->mode == ir_var_in; + return var->mode == ir_var_shader_in; default: - return var->mode == ir_var_out || var->mode == ir_var_in; + return var->mode == ir_var_shader_out || var->mode == ir_var_shader_in; } } @@ -1997,13 +1997,16 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, * the setting alone. */ if (qual->flags.q.in && qual->flags.q.out) - var->mode = ir_var_inout; - else if (qual->flags.q.attribute || qual->flags.q.in + var->mode = ir_var_function_inout; + else if (qual->flags.q.in) + var->mode = is_parameter ? ir_var_function_in : ir_var_shader_in; + else if (qual->flags.q.attribute || (qual->flags.q.varying && (state->target == fragment_shader))) - var->mode = ir_var_in; - else if (qual->flags.q.out - || (qual->flags.q.varying && (state->target == vertex_shader))) - var->mode = ir_var_out; + var->mode = ir_var_shader_in; + else if (qual->flags.q.out) + var->mode = is_parameter ? ir_var_function_out : ir_var_shader_out; + else if (qual->flags.q.varying && (state->target == vertex_shader)) + var->mode = ir_var_shader_out; else if (qual->flags.q.uniform) var->mode = ir_var_uniform; @@ -2058,15 +2061,16 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, if (state->all_invariant && (state->current_function == NULL)) { switch (state->target) { case vertex_shader: - if (var->mode == ir_var_out) + if (var->mode == ir_var_shader_out) var->invariant = true; break; case geometry_shader: - if ((var->mode == ir_var_in) || (var->mode == ir_var_out)) + if ((var->mode == ir_var_shader_in) + || (var->mode == ir_var_shader_out)) var->invariant = true; break; case fragment_shader: - if (var->mode == ir_var_in) + if (var->mode == ir_var_shader_in) var->invariant = true; break; } @@ -2082,8 +2086,8 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, var->interpolation = INTERP_QUALIFIER_NONE; if (var->interpolation != INTERP_QUALIFIER_NONE && - !(state->target == vertex_shader && var->mode == ir_var_out) && - !(state->target == fragment_shader && var->mode == ir_var_in)) { + !(state->target == vertex_shader && var->mode == ir_var_shader_out) && + !(state->target == fragment_shader && var->mode == ir_var_shader_in)) { _mesa_glsl_error(loc, state, "interpolation qualifier `%s' can only be applied to " "vertex shader outputs and fragment shader inputs.", @@ -2116,7 +2120,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, */ switch (state->target) { case vertex_shader: - if (!global_scope || (var->mode != ir_var_in)) { + if (!global_scope || (var->mode != ir_var_shader_in)) { fail = true; string = "input"; } @@ -2129,7 +2133,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, break; case fragment_shader: - if (!global_scope || (var->mode != ir_var_out)) { + if (!global_scope || (var->mode != ir_var_shader_out)) { fail = true; string = "output"; } @@ -2440,7 +2444,7 @@ process_initializer(ir_variable *var, ast_declaration *decl, "cannot initialize samplers"); } - if ((var->mode == ir_var_in) && (state->current_function == NULL)) { + if ((var->mode == ir_var_shader_in) && (state->current_function == NULL)) { _mesa_glsl_error(& initializer_loc, state, "cannot initialize %s shader input / %s", _mesa_glsl_shader_target_name(state->target), @@ -2579,12 +2583,12 @@ ast_declarator_list::hir(exec_list *instructions, "Undeclared variable `%s' cannot be marked " "invariant\n", decl->identifier); } else if ((state->target == vertex_shader) - && (earlier->mode != ir_var_out)) { + && (earlier->mode != ir_var_shader_out)) { _mesa_glsl_error(& loc, state, "`%s' cannot be marked invariant, vertex shader " "outputs only\n", decl->identifier); } else if ((state->target == fragment_shader) - && (earlier->mode != ir_var_in)) { + && (earlier->mode != ir_var_shader_in)) { _mesa_glsl_error(& loc, state, "`%s' cannot be marked invariant, fragment shader " "inputs only\n", decl->identifier); @@ -2707,16 +2711,13 @@ ast_declarator_list::hir(exec_list *instructions, & loc, this->ubo_qualifiers_valid, false); if (this->type->qualifier.flags.q.invariant) { - if ((state->target == vertex_shader) && !(var->mode == ir_var_out || - var->mode == ir_var_inout)) { - /* FINISHME: Note that this doesn't work for invariant on - * a function signature outval - */ + if ((state->target == vertex_shader) && + var->mode != ir_var_shader_out) { _mesa_glsl_error(& loc, state, "`%s' cannot be marked invariant, vertex shader " "outputs only\n", var->name); } else if ((state->target == fragment_shader) && - !(var->mode == ir_var_in || var->mode == ir_var_inout)) { + var->mode != ir_var_shader_in) { /* FINISHME: Note that this doesn't work for invariant on * a function signature inval */ @@ -2753,7 +2754,7 @@ ast_declarator_list::hir(exec_list *instructions, "global scope%s", mode, var->name, extra); } - } else if (var->mode == ir_var_in) { + } else if (var->mode == ir_var_shader_in) { var->read_only = true; if (state->target == vertex_shader) { @@ -2833,7 +2834,7 @@ ast_declarator_list::hir(exec_list *instructions, && state->target == vertex_shader && state->current_function == NULL && var->type->is_integer() - && var->mode == ir_var_out + && var->mode == ir_var_shader_out && var->interpolation != INTERP_QUALIFIER_FLAT) { _mesa_glsl_error(&loc, state, "If a vertex output is an integer, " @@ -3137,7 +3138,8 @@ ast_parameter_declarator::hir(exec_list *instructions, } is_void = false; - ir_variable *var = new(ctx) ir_variable(type, this->identifier, ir_var_in); + ir_variable *var = new(ctx) + ir_variable(type, this->identifier, ir_var_function_in); /* Apply any specified qualifiers to the parameter declaration. Note that * for function parameters the default mode is 'in'. @@ -3151,7 +3153,7 @@ ast_parameter_declarator::hir(exec_list *instructions, * as out or inout function parameters, nor can they be assigned * into." */ - if ((var->mode == ir_var_inout || var->mode == ir_var_out) + if ((var->mode == ir_var_function_inout || var->mode == ir_var_function_out) && type->contains_sampler()) { _mesa_glsl_error(&loc, state, "out and inout parameters cannot contain samplers"); type = glsl_type::error_type; @@ -3171,7 +3173,7 @@ ast_parameter_declarator::hir(exec_list *instructions, * So for GLSL 1.10, passing an array as an out or inout parameter is not * allowed. This restriction is removed in GLSL 1.20, and in GLSL ES. */ - if ((var->mode == ir_var_inout || var->mode == ir_var_out) + if ((var->mode == ir_var_function_inout || var->mode == ir_var_function_out) && type->is_array() && !state->check_version(120, 100, &loc, "Arrays cannot be out or inout parameters")) { @@ -4222,7 +4224,7 @@ detect_conflicting_assignments(struct _mesa_glsl_parse_state *state, gl_FragData_assigned = true; else if (strncmp(var->name, "gl_", 3) != 0) { if (state->target == fragment_shader && - (var->mode == ir_var_out || var->mode == ir_var_inout)) { + var->mode == ir_var_shader_out) { user_defined_fs_output_assigned = true; user_defined_fs_output = var; } diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index f2a804986cd..ccee7746e55 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -47,18 +47,18 @@ struct builtin_variable { }; static const builtin_variable builtin_core_vs_variables[] = { - { ir_var_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, - { ir_var_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, + { ir_var_shader_out, VERT_RESULT_HPOS, "vec4", "gl_Position" }, + { ir_var_shader_out, VERT_RESULT_PSIZ, "float", "gl_PointSize" }, }; static const builtin_variable builtin_core_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, - { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, - { ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, + { ir_var_shader_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, + { ir_var_shader_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_shader_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, }; static const builtin_variable builtin_100ES_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_300ES_vs_variables[] = { @@ -66,46 +66,46 @@ static const builtin_variable builtin_300ES_vs_variables[] = { }; static const builtin_variable builtin_300ES_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, - { ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, - { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, - { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, + { ir_var_shader_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_shader_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, + { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_110_fs_variables[] = { - { ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, + { ir_var_shader_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, }; static const builtin_variable builtin_110_deprecated_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, - { ir_var_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, - { ir_var_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, + { ir_var_shader_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, + { ir_var_shader_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, + { ir_var_shader_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, }; static const builtin_variable builtin_110_deprecated_vs_variables[] = { - { ir_var_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, - { ir_var_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, - { ir_var_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, - { ir_var_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, - { ir_var_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, - { ir_var_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, - { ir_var_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, - { ir_var_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, - { ir_var_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, - { ir_var_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, - { ir_var_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, - { ir_var_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, - { ir_var_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, - { ir_var_out, VERT_RESULT_CLIP_VERTEX, "vec4", "gl_ClipVertex" }, - { ir_var_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, - { ir_var_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, - { ir_var_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, - { ir_var_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, - { ir_var_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, + { ir_var_shader_in, VERT_ATTRIB_POS, "vec4", "gl_Vertex" }, + { ir_var_shader_in, VERT_ATTRIB_NORMAL, "vec3", "gl_Normal" }, + { ir_var_shader_in, VERT_ATTRIB_COLOR0, "vec4", "gl_Color" }, + { ir_var_shader_in, VERT_ATTRIB_COLOR1, "vec4", "gl_SecondaryColor" }, + { ir_var_shader_in, VERT_ATTRIB_TEX0, "vec4", "gl_MultiTexCoord0" }, + { ir_var_shader_in, VERT_ATTRIB_TEX1, "vec4", "gl_MultiTexCoord1" }, + { ir_var_shader_in, VERT_ATTRIB_TEX2, "vec4", "gl_MultiTexCoord2" }, + { ir_var_shader_in, VERT_ATTRIB_TEX3, "vec4", "gl_MultiTexCoord3" }, + { ir_var_shader_in, VERT_ATTRIB_TEX4, "vec4", "gl_MultiTexCoord4" }, + { ir_var_shader_in, VERT_ATTRIB_TEX5, "vec4", "gl_MultiTexCoord5" }, + { ir_var_shader_in, VERT_ATTRIB_TEX6, "vec4", "gl_MultiTexCoord6" }, + { ir_var_shader_in, VERT_ATTRIB_TEX7, "vec4", "gl_MultiTexCoord7" }, + { ir_var_shader_in, VERT_ATTRIB_FOG, "float", "gl_FogCoord" }, + { ir_var_shader_out, VERT_RESULT_CLIP_VERTEX, "vec4", "gl_ClipVertex" }, + { ir_var_shader_out, VERT_RESULT_COL0, "vec4", "gl_FrontColor" }, + { ir_var_shader_out, VERT_RESULT_BFC0, "vec4", "gl_BackColor" }, + { ir_var_shader_out, VERT_RESULT_COL1, "vec4", "gl_FrontSecondaryColor" }, + { ir_var_shader_out, VERT_RESULT_BFC1, "vec4", "gl_BackSecondaryColor" }, + { ir_var_shader_out, VERT_RESULT_FOGC, "float", "gl_FogFragCoord" }, }; static const builtin_variable builtin_120_fs_variables[] = { - { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_130_vs_variables[] = { @@ -403,12 +403,12 @@ add_variable(exec_list *instructions, glsl_symbol_table *symtab, switch (var->mode) { case ir_var_auto: - case ir_var_in: + case ir_var_shader_in: case ir_var_uniform: case ir_var_system_value: var->read_only = true; break; - case ir_var_out: + case ir_var_shader_out: break; default: /* The only variables that are added using this function should be @@ -754,7 +754,8 @@ generate_110_vs_variables(exec_list *instructions, glsl_type::get_array_instance(glsl_type::vec4_type, 0); add_variable(instructions, state->symbols, - "gl_TexCoord", vec4_array_type, ir_var_out, VERT_RESULT_TEX0); + "gl_TexCoord", vec4_array_type, ir_var_shader_out, + VERT_RESULT_TEX0); generate_ARB_draw_buffers_variables(instructions, state, false, vertex_shader); @@ -814,7 +815,7 @@ generate_130_vs_variables(exec_list *instructions, glsl_type::get_array_instance(glsl_type::float_type, 0); add_variable(instructions, state->symbols, - "gl_ClipDistance", clip_distance_array_type, ir_var_out, + "gl_ClipDistance", clip_distance_array_type, ir_var_shader_out, VERT_RESULT_CLIP_DIST0); } @@ -939,7 +940,8 @@ generate_110_fs_variables(exec_list *instructions, glsl_type::get_array_instance(glsl_type::vec4_type, 0); add_variable(instructions, state->symbols, - "gl_TexCoord", vec4_array_type, ir_var_in, FRAG_ATTRIB_TEX0); + "gl_TexCoord", vec4_array_type, ir_var_shader_in, + FRAG_ATTRIB_TEX0); generate_ARB_draw_buffers_variables(instructions, state, false, fragment_shader); @@ -971,7 +973,7 @@ generate_ARB_draw_buffers_variables(exec_list *instructions, ir_variable *const fd = add_variable(instructions, state->symbols, "gl_FragData", vec4_array_type, - ir_var_out, FRAG_RESULT_DATA0); + ir_var_shader_out, FRAG_RESULT_DATA0); if (warn) fd->warn_extension = "GL_ARB_draw_buffers"; @@ -1028,7 +1030,7 @@ generate_ARB_shader_stencil_export_variables(exec_list *instructions, ir_variable *const fd = add_variable(instructions, state->symbols, "gl_FragStencilRefARB", glsl_type::int_type, - ir_var_out, FRAG_RESULT_STENCIL); + ir_var_shader_out, FRAG_RESULT_STENCIL); if (warn) fd->warn_extension = "GL_ARB_shader_stencil_export"; @@ -1044,7 +1046,7 @@ generate_AMD_shader_stencil_export_variables(exec_list *instructions, ir_variable *const fd = add_variable(instructions, state->symbols, "gl_FragStencilRefAMD", glsl_type::int_type, - ir_var_out, FRAG_RESULT_STENCIL); + ir_var_shader_out, FRAG_RESULT_STENCIL); if (warn) fd->warn_extension = "GL_AMD_shader_stencil_export"; @@ -1085,7 +1087,7 @@ generate_fs_clipdistance(exec_list *instructions, glsl_type::get_array_instance(glsl_type::float_type, 0); add_variable(instructions, state->symbols, - "gl_ClipDistance", clip_distance_array_type, ir_var_in, + "gl_ClipDistance", clip_distance_array_type, ir_var_shader_in, FRAG_ATTRIB_CLIP_DIST0); } diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 703f5ec58ef..75a9f24cf29 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1553,8 +1553,8 @@ modes_match(unsigned a, unsigned b) return true; /* Accept "in" vs. "const in" */ - if ((a == ir_var_const_in && b == ir_var_in) || - (b == ir_var_const_in && a == ir_var_in)) + if ((a == ir_var_const_in && b == ir_var_function_in) || + (b == ir_var_const_in && a == ir_var_function_in)) return true; return false; diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 85fc5ce95da..de687d38545 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -265,9 +265,11 @@ protected: enum ir_variable_mode { ir_var_auto = 0, /**< Function local variables and globals. */ ir_var_uniform, /**< Variable declared as a uniform. */ - ir_var_in, - ir_var_out, - ir_var_inout, + ir_var_shader_in, + ir_var_shader_out, + ir_var_function_in, + ir_var_function_out, + ir_var_function_inout, ir_var_const_in, /**< "in" param that must be a constant expression */ ir_var_system_value, /**< Ex: front-face, instance-id, etc. */ ir_var_temporary /**< Temporary variable generated during compilation. */ @@ -401,7 +403,7 @@ public: * * \sa ir_variable_mode */ - unsigned mode:3; + unsigned mode:4; /** * Interpolation mode for shader inputs / outputs diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp index a525693ed96..fe4209c77cc 100644 --- a/src/glsl/ir_function.cpp +++ b/src/glsl/ir_function.cpp @@ -78,17 +78,17 @@ parameter_lists_match(const exec_list *list_a, const exec_list *list_b) return PARAMETER_LIST_NO_MATCH; case ir_var_const_in: - case ir_var_in: + case ir_var_function_in: if (!actual->type->can_implicitly_convert_to(param->type)) return PARAMETER_LIST_NO_MATCH; break; - case ir_var_out: + case ir_var_function_out: if (!param->type->can_implicitly_convert_to(actual->type)) return PARAMETER_LIST_NO_MATCH; break; - case ir_var_inout: + case ir_var_function_inout: /* Since there are no bi-directional automatic conversions (e.g., * there is int -> float but no float -> int), inout parameters must * be exact matches. diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 8aa26e5d018..acc92dbf165 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -146,7 +146,8 @@ void ir_print_visitor::visit(ir_variable *ir) const char *const cent = (ir->centroid) ? "centroid " : ""; const char *const inv = (ir->invariant) ? "invariant " : ""; - const char *const mode[] = { "", "uniform ", "in ", "out ", "inout ", + const char *const mode[] = { "", "uniform ", "shader_in ", "shader_out ", + "in ", "out ", "inout ", "const_in ", "sys ", "temporary " }; const char *const interp[] = { "", "flat", "noperspective" }; diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp index 03dbb67c327..405e75b6413 100644 --- a/src/glsl/ir_reader.cpp +++ b/src/glsl/ir_reader.cpp @@ -400,13 +400,17 @@ ir_reader::read_declaration(s_expression *expr) } else if (strcmp(qualifier->value(), "auto") == 0) { var->mode = ir_var_auto; } else if (strcmp(qualifier->value(), "in") == 0) { - var->mode = ir_var_in; + var->mode = ir_var_function_in; + } else if (strcmp(qualifier->value(), "shader_in") == 0) { + var->mode = ir_var_shader_in; } else if (strcmp(qualifier->value(), "const_in") == 0) { var->mode = ir_var_const_in; } else if (strcmp(qualifier->value(), "out") == 0) { - var->mode = ir_var_out; + var->mode = ir_var_function_out; + } else if (strcmp(qualifier->value(), "shader_out") == 0) { + var->mode = ir_var_shader_out; } else if (strcmp(qualifier->value(), "inout") == 0) { - var->mode = ir_var_inout; + var->mode = ir_var_function_inout; } else if (strcmp(qualifier->value(), "temporary") == 0) { var->mode = ir_var_temporary; } else if (strcmp(qualifier->value(), "smooth") == 0) { diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp index e5de07e0122..1e102bfbb68 100644 --- a/src/glsl/ir_set_program_inouts.cpp +++ b/src/glsl/ir_set_program_inouts.cpp @@ -85,7 +85,7 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len, for (int i = 0; i < len; i++) { GLbitfield64 bitfield = BITFIELD64_BIT(var->location + var->index + offset + i); - if (var->mode == ir_var_in) { + if (var->mode == ir_var_shader_in) { prog->InputsRead |= bitfield; if (is_fragment_shader) { gl_fragment_program *fprog = (gl_fragment_program *) prog; @@ -152,8 +152,8 @@ ir_set_program_inouts_visitor::visit_enter(ir_dereference_array *ir) ir_visitor_status ir_set_program_inouts_visitor::visit(ir_variable *ir) { - if (ir->mode == ir_var_in || - ir->mode == ir_var_out || + if (ir->mode == ir_var_shader_in || + ir->mode == ir_var_shader_out || ir->mode == ir_var_system_value) { hash_table_insert(this->ht, ir, ir); } diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index ad57a3149b1..ac3e832d5cc 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -605,8 +605,8 @@ ir_validate::visit_enter(ir_call *ir) printf("ir_call parameter type mismatch:\n"); goto dump_ir; } - if (formal_param->mode == ir_var_out - || formal_param->mode == ir_var_inout) { + if (formal_param->mode == ir_var_function_out + || formal_param->mode == ir_var_function_inout) { if (!actual_param->is_lvalue()) { printf("ir_call out/inout parameters must be lvalues:\n"); goto dump_ir; diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 5c27f231e72..5a3240b9f71 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -54,10 +54,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog, foreach_list(node, producer->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); - /* FINISHME: For geometry shaders, this should also look for inout - * FINISHME: variables. - */ - if ((var == NULL) || (var->mode != ir_var_out)) + if ((var == NULL) || (var->mode != ir_var_shader_out)) continue; parameters.add_variable(var); @@ -71,10 +68,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog, foreach_list(node, consumer->ir) { ir_variable *const input = ((ir_instruction *) node)->as_variable(); - /* FINISHME: For geometry shaders, this should also look for inout - * FINISHME: variables. - */ - if ((input == NULL) || (input->mode != ir_var_in)) + if ((input == NULL) || (input->mode != ir_var_shader_in)) continue; ir_variable *const output = parameters.get_variable(input->name); @@ -417,7 +411,7 @@ tfeedback_decl::find_output_var(gl_shader_program *prog, const char *name = this->is_clip_distance_mesa ? "gl_ClipDistanceMESA" : this->var_name; ir_variable *var = producer->symbols->get_variable(name); - if (var && var->mode == ir_var_out) + if (var && var->mode == ir_var_shader_out) return var; /* From GL_EXT_transform_feedback: @@ -854,7 +848,7 @@ is_varying_var(GLenum shaderType, const ir_variable *var) { /* Only fragment shaders will take a varying variable as an input */ if (shaderType == GL_FRAGMENT_SHADER && - var->mode == ir_var_in) { + var->mode == ir_var_shader_in) { switch (var->location) { case FRAG_ATTRIB_WPOS: case FRAG_ATTRIB_FACE: @@ -915,13 +909,13 @@ assign_varying_locations(struct gl_context *ctx, foreach_list(node, producer->ir) { ir_variable *const output_var = ((ir_instruction *) node)->as_variable(); - if ((output_var == NULL) || (output_var->mode != ir_var_out)) + if ((output_var == NULL) || (output_var->mode != ir_var_shader_out)) continue; ir_variable *input_var = consumer ? consumer->symbols->get_variable(output_var->name) : NULL; - if (input_var && input_var->mode != ir_var_in) + if (input_var && input_var->mode != ir_var_shader_in) input_var = NULL; if (input_var) { @@ -965,11 +959,11 @@ assign_varying_locations(struct gl_context *ctx, */ assert(!ctx->Extensions.EXT_transform_feedback); } else { - lower_packed_varyings(mem_ctx, producer_base, slots_used, ir_var_out, - producer); + lower_packed_varyings(mem_ctx, producer_base, slots_used, + ir_var_shader_out, producer); if (consumer) { - lower_packed_varyings(mem_ctx, consumer_base, slots_used, ir_var_in, - consumer); + lower_packed_varyings(mem_ctx, consumer_base, slots_used, + ir_var_shader_in, consumer); } } @@ -979,7 +973,7 @@ assign_varying_locations(struct gl_context *ctx, foreach_list(node, consumer->ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); - if ((var == NULL) || (var->mode != ir_var_in)) + if ((var == NULL) || (var->mode != ir_var_shader_in)) continue; if (var->is_unmatched_generic_inout) { diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 63548e07117..1d4e2f6e793 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -107,8 +107,8 @@ public: ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *sig_param = (ir_variable *)sig_iter.get(); - if (sig_param->mode == ir_var_out || - sig_param->mode == ir_var_inout) { + if (sig_param->mode == ir_var_function_out || + sig_param->mode == ir_var_function_inout) { ir_variable *var = param_rval->variable_referenced(); if (var && strcmp(name, var->name) == 0) { found = true; @@ -212,10 +212,10 @@ link_invalidate_variable_locations(gl_shader *sh, int input_base, int base; switch (var->mode) { - case ir_var_in: + case ir_var_shader_in: base = input_base; break; - case ir_var_out: + case ir_var_shader_out: base = output_base; break; default: @@ -393,10 +393,9 @@ mode_string(const ir_variable *var) case ir_var_auto: return (var->read_only) ? "global constant" : "global variable"; - case ir_var_uniform: return "uniform"; - case ir_var_in: return "shader input"; - case ir_var_out: return "shader output"; - case ir_var_inout: return "shader inout"; + case ir_var_uniform: return "uniform"; + case ir_var_shader_in: return "shader input"; + case ir_var_shader_out: return "shader output"; case ir_var_const_in: case ir_var_temporary: @@ -1069,8 +1068,8 @@ update_array_sizes(struct gl_shader_program *prog) ir_variable *const var = ((ir_instruction *) node)->as_variable(); if ((var == NULL) || (var->mode != ir_var_uniform && - var->mode != ir_var_in && - var->mode != ir_var_out) || + var->mode != ir_var_shader_in && + var->mode != ir_var_shader_out) || !var->type->is_array()) continue; @@ -1206,7 +1205,8 @@ assign_attribute_or_color_locations(gl_shader_program *prog, ? (int) VERT_ATTRIB_GENERIC0 : (int) FRAG_RESULT_DATA0; const enum ir_variable_mode direction = - (target_index == MESA_SHADER_VERTEX) ? ir_var_in : ir_var_out; + (target_index == MESA_SHADER_VERTEX) + ? ir_var_shader_in : ir_var_shader_out; /* Temporary storage for the set of attributes that need locations assigned. @@ -1428,7 +1428,7 @@ store_fragdepth_layout(struct gl_shader_program *prog) foreach_list(node, ir) { ir_variable *const var = ((ir_instruction *) node)->as_variable(); - if (var == NULL || var->mode != ir_var_out) { + if (var == NULL || var->mode != ir_var_shader_out) { continue; } @@ -1809,7 +1809,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) { demote_shader_inputs_and_outputs(prog->_LinkedShaders[MESA_SHADER_VERTEX], - ir_var_out); + ir_var_shader_out); /* Eliminate code that is now dead due to unused vertex outputs being * demoted. @@ -1821,9 +1821,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) { gl_shader *const sh = prog->_LinkedShaders[MESA_SHADER_GEOMETRY]; - demote_shader_inputs_and_outputs(sh, ir_var_in); - demote_shader_inputs_and_outputs(sh, ir_var_inout); - demote_shader_inputs_and_outputs(sh, ir_var_out); + demote_shader_inputs_and_outputs(sh, ir_var_shader_in); + demote_shader_inputs_and_outputs(sh, ir_var_shader_out); /* Eliminate code that is now dead due to unused geometry outputs being * demoted. @@ -1835,7 +1834,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) { gl_shader *const sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; - demote_shader_inputs_and_outputs(sh, ir_var_in); + demote_shader_inputs_and_outputs(sh, ir_var_shader_in); /* Eliminate code that is now dead due to unused fragment inputs being * demoted. This shouldn't actually do anything other than remove diff --git a/src/glsl/lower_clip_distance.cpp b/src/glsl/lower_clip_distance.cpp index 09bdc36e169..643807de87b 100644 --- a/src/glsl/lower_clip_distance.cpp +++ b/src/glsl/lower_clip_distance.cpp @@ -301,8 +301,8 @@ lower_clip_distance_visitor::visit_leave(ir_call *ir) this->base_ir->insert_before(temp_clip_distance); actual_param->replace_with( new(ctx) ir_dereference_variable(temp_clip_distance)); - if (formal_param->mode == ir_var_in - || formal_param->mode == ir_var_inout) { + if (formal_param->mode == ir_var_function_in + || formal_param->mode == ir_var_function_inout) { /* Copy from gl_ClipDistance to the temporary before the call. * Since we are going to insert this copy before the current * instruction, we need to visit it afterwards to make sure it @@ -314,8 +314,8 @@ lower_clip_distance_visitor::visit_leave(ir_call *ir) this->base_ir->insert_before(new_assignment); this->visit_new_assignment(new_assignment); } - if (formal_param->mode == ir_var_out - || formal_param->mode == ir_var_inout) { + if (formal_param->mode == ir_var_function_out + || formal_param->mode == ir_var_function_inout) { /* Copy from the temporary to gl_ClipDistance after the call. * Since visit_list_elements() has already decided which * instruction it's going to visit next, we need to visit diff --git a/src/glsl/lower_output_reads.cpp b/src/glsl/lower_output_reads.cpp index a6192a51707..b93e254ec9b 100644 --- a/src/glsl/lower_output_reads.cpp +++ b/src/glsl/lower_output_reads.cpp @@ -41,7 +41,7 @@ class output_read_remover : public ir_hierarchical_visitor { protected: /** * A hash table mapping from the original ir_variable shader outputs - * (ir_var_out mode) to the new temporaries to be used instead. + * (ir_var_shader_out mode) to the new temporaries to be used instead. */ hash_table *replacements; @@ -86,7 +86,7 @@ output_read_remover::~output_read_remover() ir_visitor_status output_read_remover::visit(ir_dereference_variable *ir) { - if (ir->var->mode != ir_var_out) + if (ir->var->mode != ir_var_shader_out) return visit_continue; ir_variable *temp = (ir_variable *) hash_table_find(replacements, ir->var); diff --git a/src/glsl/lower_packed_varyings.cpp b/src/glsl/lower_packed_varyings.cpp index 9e7f274b7d1..8f05752ed4b 100644 --- a/src/glsl/lower_packed_varyings.cpp +++ b/src/glsl/lower_packed_varyings.cpp @@ -135,8 +135,8 @@ private: ir_variable **packed_varyings; /** - * Type of varying which is being lowered in this pass (either ir_var_in or - * ir_var_out). + * Type of varying which is being lowered in this pass (either + * ir_var_shader_in or ir_var_shader_out). */ const ir_variable_mode mode; @@ -336,7 +336,7 @@ lower_packed_varyings_visitor::lower_rvalue(ir_rvalue *rvalue, unpacked_var, name)); ir_swizzle *swizzle = new(this->mem_ctx) ir_swizzle(packed_deref, swizzle_values, components); - if (this->mode == ir_var_out) { + if (this->mode == ir_var_shader_out) { ir_assignment *assignment = this->bitwise_assign_pack(swizzle, rvalue); this->main_instructions->push_tail(assignment); diff --git a/src/glsl/lower_variable_index_to_cond_assign.cpp b/src/glsl/lower_variable_index_to_cond_assign.cpp index 57771074a8c..040b0bf8357 100644 --- a/src/glsl/lower_variable_index_to_cond_assign.cpp +++ b/src/glsl/lower_variable_index_to_cond_assign.cpp @@ -364,12 +364,16 @@ public: return this->lower_temps; case ir_var_uniform: return this->lower_uniforms; - case ir_var_in: + case ir_var_function_in: case ir_var_const_in: - return (var->location == -1) ? this->lower_temps : this->lower_inputs; - case ir_var_out: - return (var->location == -1) ? this->lower_temps : this->lower_outputs; - case ir_var_inout: + return this->lower_temps; + case ir_var_shader_in: + return this->lower_inputs; + case ir_var_function_out: + return this->lower_temps; + case ir_var_shader_out: + return this->lower_outputs; + case ir_var_function_inout: return this->lower_temps; } diff --git a/src/glsl/opt_constant_folding.cpp b/src/glsl/opt_constant_folding.cpp index 7d94d481c9f..072fefe9ab8 100644 --- a/src/glsl/opt_constant_folding.cpp +++ b/src/glsl/opt_constant_folding.cpp @@ -127,7 +127,8 @@ ir_constant_folding_visitor::visit_enter(ir_call *ir) ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *sig_param = (ir_variable *)sig_iter.get(); - if (sig_param->mode == ir_var_in || sig_param->mode == ir_var_const_in) { + if (sig_param->mode == ir_var_function_in + || sig_param->mode == ir_var_const_in) { ir_rvalue *new_param = param_rval; handle_rvalue(&new_param); diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp index a03811999a0..2f65937fe9b 100644 --- a/src/glsl/opt_constant_propagation.cpp +++ b/src/glsl/opt_constant_propagation.cpp @@ -285,7 +285,8 @@ ir_constant_propagation_visitor::visit_enter(ir_call *ir) foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); ir_rvalue *param = (ir_rvalue *)iter.get(); - if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout) { + if (sig_param->mode != ir_var_function_out + && sig_param->mode != ir_var_function_inout) { ir_rvalue *new_param = param; handle_rvalue(&new_param); if (new_param != param) diff --git a/src/glsl/opt_constant_variable.cpp b/src/glsl/opt_constant_variable.cpp index 1bbaf8e4792..cbe6450c62f 100644 --- a/src/glsl/opt_constant_variable.cpp +++ b/src/glsl/opt_constant_variable.cpp @@ -137,8 +137,8 @@ ir_constant_variable_visitor::visit_enter(ir_call *ir) ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *param = (ir_variable *)sig_iter.get(); - if (param->mode == ir_var_out || - param->mode == ir_var_inout) { + if (param->mode == ir_var_function_out || + param->mode == ir_var_function_inout) { ir_variable *var = param_rval->variable_referenced(); struct assignment_entry *entry; diff --git a/src/glsl/opt_copy_propagation.cpp b/src/glsl/opt_copy_propagation.cpp index 2952ce594f7..7282b611ebc 100644 --- a/src/glsl/opt_copy_propagation.cpp +++ b/src/glsl/opt_copy_propagation.cpp @@ -189,7 +189,8 @@ ir_copy_propagation_visitor::visit_enter(ir_call *ir) foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); ir_instruction *ir = (ir_instruction *)iter.get(); - if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout) { + if (sig_param->mode != ir_var_function_out + && sig_param->mode != ir_var_function_inout) { ir->accept(this); } sig_param_iter.next(); diff --git a/src/glsl/opt_copy_propagation_elements.cpp b/src/glsl/opt_copy_propagation_elements.cpp index de9f4ef6f67..6a19da40df5 100644 --- a/src/glsl/opt_copy_propagation_elements.cpp +++ b/src/glsl/opt_copy_propagation_elements.cpp @@ -297,7 +297,8 @@ ir_copy_propagation_elements_visitor::visit_enter(ir_call *ir) foreach_iter(exec_list_iterator, iter, ir->actual_parameters) { ir_variable *sig_param = (ir_variable *)sig_param_iter.get(); ir_instruction *ir = (ir_instruction *)iter.get(); - if (sig_param->mode != ir_var_out && sig_param->mode != ir_var_inout) { + if (sig_param->mode != ir_var_function_out + && sig_param->mode != ir_var_function_inout) { ir->accept(this); } sig_param_iter.next(); diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index 47247e20d9f..dad307af779 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -77,10 +77,11 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) if (entry->assign) { /* Remove a single dead assignment to the variable we found. - * Don't do so if it's a shader output, though. + * Don't do so if it's a shader or function output, though. */ - if (entry->var->mode != ir_var_out && - entry->var->mode != ir_var_inout) { + if (entry->var->mode != ir_var_function_out && + entry->var->mode != ir_var_function_inout && + entry->var->mode != ir_var_shader_out) { entry->assign->remove(); progress = true; diff --git a/src/glsl/opt_function_inlining.cpp b/src/glsl/opt_function_inlining.cpp index f9f5bd44267..0733d5180d8 100644 --- a/src/glsl/opt_function_inlining.cpp +++ b/src/glsl/opt_function_inlining.cpp @@ -144,9 +144,9 @@ ir_call::generate_inline(ir_instruction *next_ir) } /* Move the actual param into our param variable if it's an 'in' type. */ - if (parameters[i] && (sig_param->mode == ir_var_in || + if (parameters[i] && (sig_param->mode == ir_var_function_in || sig_param->mode == ir_var_const_in || - sig_param->mode == ir_var_inout)) { + sig_param->mode == ir_var_function_inout)) { ir_assignment *assign; assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(parameters[i]), @@ -202,8 +202,8 @@ ir_call::generate_inline(ir_instruction *next_ir) const ir_variable *const sig_param = (ir_variable *) sig_param_iter.get(); /* Move our param variable into the actual param if it's an 'out' type. */ - if (parameters[i] && (sig_param->mode == ir_var_out || - sig_param->mode == ir_var_inout)) { + if (parameters[i] && (sig_param->mode == ir_var_function_out || + sig_param->mode == ir_var_function_inout)) { ir_assignment *assign; assign = new(ctx) ir_assignment(param->clone(ctx, NULL)->as_rvalue(), diff --git a/src/glsl/opt_tree_grafting.cpp b/src/glsl/opt_tree_grafting.cpp index 25b18ea940c..113abb7b043 100644 --- a/src/glsl/opt_tree_grafting.cpp +++ b/src/glsl/opt_tree_grafting.cpp @@ -211,7 +211,8 @@ ir_tree_grafting_visitor::visit_enter(ir_call *ir) ir_rvalue *ir = (ir_rvalue *)iter.get(); ir_rvalue *new_ir = ir; - if (sig_param->mode != ir_var_in && sig_param->mode != ir_var_const_in) { + if (sig_param->mode != ir_var_function_in + && sig_param->mode != ir_var_const_in) { if (check_graft(ir, sig_param) == visit_stop) return visit_stop; continue; @@ -350,8 +351,9 @@ tree_grafting_basic_block(ir_instruction *bb_first, if (!lhs_var) continue; - if (lhs_var->mode == ir_var_out || - lhs_var->mode == ir_var_inout) + if (lhs_var->mode == ir_var_function_out || + lhs_var->mode == ir_var_function_inout || + lhs_var->mode == ir_var_shader_out) continue; ir_variable_refcount_entry *entry = info->refs->get_variable_entry(lhs_var); diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index 9ca082a0fc9..5f5f6a9ba76 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -610,7 +610,7 @@ fs_visitor::setup_fp_regs() */ ir_variable *ir = new(mem_ctx) ir_variable(glsl_type::vec4_type, "fp_input", - ir_var_in); + ir_var_shader_in); ir->location = i; this->current_annotation = ralloc_asprintf(ctx, "interpolate input %d", diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index 7a12e084ff8..b9487532c59 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -110,11 +110,13 @@ ir_vector_reference_visitor::get_variable_entry(ir_variable *var) switch (var->mode) { case ir_var_uniform: - case ir_var_in: - case ir_var_out: - case ir_var_inout: + case ir_var_shader_in: + case ir_var_shader_out: + case ir_var_function_in: + case ir_var_function_out: + case ir_var_function_inout: /* Can't split varyings or uniforms. Function in/outs won't get split - * either, so don't care about the ambiguity. + * either. */ return NULL; case ir_var_auto: diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 5885989e76e..ebb37fd3113 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -57,7 +57,7 @@ fs_visitor::visit(ir_variable *ir) if (variable_storage(ir)) return; - if (ir->mode == ir_var_in) { + if (ir->mode == ir_var_shader_in) { if (!strcmp(ir->name, "gl_FragCoord")) { reg = emit_fragcoord_interpolation(ir); } else if (!strcmp(ir->name, "gl_FrontFacing")) { @@ -68,7 +68,7 @@ fs_visitor::visit(ir_variable *ir) assert(reg); hash_table_insert(this->variable_ht, reg, ir); return; - } else if (ir->mode == ir_var_out) { + } else if (ir->mode == ir_var_shader_out) { reg = new(this->mem_ctx) fs_reg(this, ir->type); if (ir->index > 0) { diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index d9ff869f2da..cff04ba887c 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -905,11 +905,11 @@ vec4_visitor::visit(ir_variable *ir) return; switch (ir->mode) { - case ir_var_in: + case ir_var_shader_in: reg = new(mem_ctx) dst_reg(ATTR, ir->location); break; - case ir_var_out: + case ir_var_shader_out: reg = new(mem_ctx) dst_reg(this, ir->type); for (int i = 0; i < type_size(ir->type); i++) { diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 27b1b8f5688..3014a97785d 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -106,7 +106,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index, const ir_variable *const var = ((ir_instruction *) node)->as_variable(); if (var == NULL - || var->mode != ir_var_in + || var->mode != ir_var_shader_in || var->location == -1) continue; @@ -169,7 +169,7 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name) * attribute, or if an error occurs, -1 will be returned." */ if (var == NULL - || var->mode != ir_var_in + || var->mode != ir_var_shader_in || var->location == -1 || var->location < VERT_ATTRIB_GENERIC0) continue; @@ -197,7 +197,7 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg) const ir_variable *const var = ((ir_instruction *) node)->as_variable(); if (var == NULL - || var->mode != ir_var_in + || var->mode != ir_var_shader_in || var->location == -1) continue; @@ -223,7 +223,7 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg) const ir_variable *const var = ((ir_instruction *) node)->as_variable(); if (var == NULL - || var->mode != ir_var_in + || var->mode != ir_var_shader_in || var->location == -1) continue; @@ -333,7 +333,7 @@ _mesa_GetFragDataIndex(GLuint program, const GLchar *name) * attribute, or if an error occurs, -1 will be returned." */ if (var == NULL - || var->mode != ir_var_out + || var->mode != ir_var_shader_out || var->location == -1 || var->location < FRAG_RESULT_DATA0) continue; @@ -389,7 +389,7 @@ _mesa_GetFragDataLocation(GLuint program, const GLchar *name) * attribute, or if an error occurs, -1 will be returned." */ if (var == NULL - || var->mode != ir_var_out + || var->mode != ir_var_shader_out || var->location == -1 || var->location < FRAG_RESULT_DATA0) continue; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 0f7439b3b06..4723ec3578b 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -1529,21 +1529,18 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) var->location); this->variables.push_tail(entry); break; - case ir_var_in: - case ir_var_inout: + case ir_var_shader_in: /* The linker assigns locations for varyings and attributes, * including deprecated builtins (like gl_Color), * user-assigned generic attributes (glBindVertexLocation), * and user-defined varyings. - * - * FINISHME: We would hit this path for function arguments. Fix! */ assert(var->location != -1); entry = new(mem_ctx) variable_storage(var, PROGRAM_INPUT, var->location); break; - case ir_var_out: + case ir_var_shader_out: assert(var->location != -1); entry = new(mem_ctx) variable_storage(var, PROGRAM_OUTPUT, diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 1d96e905c1e..575636e6e57 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2001,21 +2001,18 @@ glsl_to_tgsi_visitor::visit(ir_dereference_variable *ir) var->location); this->variables.push_tail(entry); break; - case ir_var_in: - case ir_var_inout: + case ir_var_shader_in: /* The linker assigns locations for varyings and attributes, * including deprecated builtins (like gl_Color), user-assign * generic attributes (glBindVertexLocation), and * user-defined varyings. - * - * FINISHME: We would hit this path for function arguments. Fix! */ assert(var->location != -1); entry = new(mem_ctx) variable_storage(var, PROGRAM_INPUT, var->location); break; - case ir_var_out: + case ir_var_shader_out: assert(var->location != -1); entry = new(mem_ctx) variable_storage(var, PROGRAM_OUTPUT, @@ -2304,7 +2301,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector()); l.writemask = WRITEMASK_XYZW; } else if (ir->lhs->type->is_scalar() && - ir->lhs->variable_referenced()->mode == ir_var_out) { + ir->lhs->variable_referenced()->mode == ir_var_shader_out) { /* FINISHME: This hack makes writing to gl_FragDepth, which lives in the * FINISHME: W component of fragment shader output zero, work correctly. */ @@ -2581,8 +2578,8 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *param = (ir_variable *)sig_iter.get(); - if (param->mode == ir_var_in || - param->mode == ir_var_inout) { + if (param->mode == ir_var_function_in || + param->mode == ir_var_function_inout) { variable_storage *storage = find_variable_storage(param); assert(storage); @@ -2617,8 +2614,8 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) ir_rvalue *param_rval = (ir_rvalue *)iter.get(); ir_variable *param = (ir_variable *)sig_iter.get(); - if (param->mode == ir_var_out || - param->mode == ir_var_inout) { + if (param->mode == ir_var_function_out || + param->mode == ir_var_function_inout) { variable_storage *storage = find_variable_storage(param); assert(storage); |