diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/ast_function.cpp | 19 | ||||
-rw-r--r-- | src/compiler/glsl/lower_named_interface_blocks.cpp | 18 |
2 files changed, 32 insertions, 5 deletions
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp index 46a61e46fd5..d1596c272e6 100644 --- a/src/compiler/glsl/ast_function.cpp +++ b/src/compiler/glsl/ast_function.cpp @@ -227,19 +227,28 @@ verify_parameter_modes(_mesa_glsl_parse_state *state, val = ((ir_swizzle *)val)->val; } - while (val->ir_type == ir_type_dereference_array) { - val = ((ir_dereference_array *)val)->array; + for (;;) { + if (val->ir_type == ir_type_dereference_array) { + val = ((ir_dereference_array *)val)->array; + } else if (val->ir_type == ir_type_dereference_record && + !state->es_shader) { + val = ((ir_dereference_record *)val)->record; + } else + break; } - if (!val->as_dereference_variable() || - val->variable_referenced()->data.mode != ir_var_shader_in) { + ir_variable *var = NULL; + if (const ir_dereference_variable *deref_var = val->as_dereference_variable()) + var = deref_var->variable_referenced(); + + if (!var || var->data.mode != ir_var_shader_in) { _mesa_glsl_error(&loc, state, "parameter `%s` must be a shader input", formal->name); return false; } - val->variable_referenced()->data.must_be_shader_input = 1; + var->data.must_be_shader_input = 1; } /* Verify that 'out' and 'inout' actual parameters are lvalues. */ diff --git a/src/compiler/glsl/lower_named_interface_blocks.cpp b/src/compiler/glsl/lower_named_interface_blocks.cpp index 064694128bf..136352a131b 100644 --- a/src/compiler/glsl/lower_named_interface_blocks.cpp +++ b/src/compiler/glsl/lower_named_interface_blocks.cpp @@ -115,6 +115,7 @@ public: void run(exec_list *instructions); virtual ir_visitor_status visit_leave(ir_assignment *); + virtual ir_visitor_status visit_leave(ir_expression *); virtual void handle_rvalue(ir_rvalue **rvalue); }; @@ -238,6 +239,23 @@ flatten_named_interface_blocks_declarations::visit_leave(ir_assignment *ir) return rvalue_visit(ir); } +ir_visitor_status +flatten_named_interface_blocks_declarations::visit_leave(ir_expression *ir) +{ + ir_visitor_status status = rvalue_visit(ir); + + if (ir->operation == ir_unop_interpolate_at_centroid || + ir->operation == ir_binop_interpolate_at_offset || + ir->operation == ir_binop_interpolate_at_sample) { + const ir_rvalue *val = ir->operands[0]; + + /* This disables varying packing for this input. */ + val->variable_referenced()->data.must_be_shader_input = 1; + } + + return status; +} + void flatten_named_interface_blocks_declarations::handle_rvalue(ir_rvalue **rvalue) { |