mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
glsl: Keep track of centroid/interpolation mode for interface block members.
Fixes piglit tests:
- interface-block-interpolation-{array,named,unnamed}
- glsl-1.50-interface-block-centroid {array,named,unnamed}
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
e17d671d9f
commit
99512dc40d
5 changed files with 38 additions and 0 deletions
|
|
@ -4525,6 +4525,9 @@ ast_process_structure_or_interface_block(exec_list *instructions,
|
|||
fields[i].type = field_type;
|
||||
fields[i].name = decl->identifier;
|
||||
fields[i].location = -1;
|
||||
fields[i].interpolation =
|
||||
interpret_interpolation_qualifier(qual, var_mode, state, &loc);
|
||||
fields[i].centroid = qual->flags.q.centroid ? 1 : 0;
|
||||
|
||||
if (qual->flags.q.row_major || qual->flags.q.column_major) {
|
||||
if (!qual->flags.q.uniform) {
|
||||
|
|
@ -4789,6 +4792,10 @@ ast_interface_block::hir(exec_list *instructions,
|
|||
} else {
|
||||
fields[i].location =
|
||||
earlier_per_vertex->fields.structure[j].location;
|
||||
fields[i].interpolation =
|
||||
earlier_per_vertex->fields.structure[j].interpolation;
|
||||
fields[i].centroid =
|
||||
earlier_per_vertex->fields.structure[j].centroid;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4924,6 +4931,8 @@ ast_interface_block::hir(exec_list *instructions,
|
|||
new(state) ir_variable(fields[i].type,
|
||||
ralloc_strdup(state, fields[i].name),
|
||||
var_mode);
|
||||
var->interpolation = fields[i].interpolation;
|
||||
var->centroid = fields[i].centroid;
|
||||
var->init_interface_type(block_type);
|
||||
|
||||
if (redeclaring_per_vertex) {
|
||||
|
|
|
|||
|
|
@ -326,6 +326,8 @@ per_vertex_accumulator::add_field(int slot, const glsl_type *type,
|
|||
this->fields[this->num_fields].name = name;
|
||||
this->fields[this->num_fields].row_major = false;
|
||||
this->fields[this->num_fields].location = slot;
|
||||
this->fields[this->num_fields].interpolation = INTERP_QUALIFIER_NONE;
|
||||
this->fields[this->num_fields].centroid = 0;
|
||||
this->num_fields++;
|
||||
}
|
||||
|
||||
|
|
@ -899,6 +901,8 @@ builtin_variable_generator::generate_varyings()
|
|||
ir_variable *var =
|
||||
add_variable(fields[i].name, fields[i].type, ir_var_shader_out,
|
||||
fields[i].location);
|
||||
var->interpolation = fields[i].interpolation;
|
||||
var->centroid = fields[i].centroid;
|
||||
var->init_interface_type(per_vertex_out_type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
|
|||
this->fields.structure[i].name = ralloc_strdup(this->fields.structure,
|
||||
fields[i].name);
|
||||
this->fields.structure[i].location = fields[i].location;
|
||||
this->fields.structure[i].interpolation = fields[i].interpolation;
|
||||
this->fields.structure[i].centroid = fields[i].centroid;
|
||||
this->fields.structure[i].row_major = fields[i].row_major;
|
||||
}
|
||||
}
|
||||
|
|
@ -126,6 +128,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
|
|||
this->fields.structure[i].name = ralloc_strdup(this->fields.structure,
|
||||
fields[i].name);
|
||||
this->fields.structure[i].location = fields[i].location;
|
||||
this->fields.structure[i].interpolation = fields[i].interpolation;
|
||||
this->fields.structure[i].centroid = fields[i].centroid;
|
||||
this->fields.structure[i].row_major = fields[i].row_major;
|
||||
}
|
||||
}
|
||||
|
|
@ -455,6 +459,12 @@ glsl_type::record_key_compare(const void *a, const void *b)
|
|||
if (key1->fields.structure[i].location
|
||||
!= key2->fields.structure[i].location)
|
||||
return 1;
|
||||
if (key1->fields.structure[i].interpolation
|
||||
!= key2->fields.structure[i].interpolation)
|
||||
return 1;
|
||||
if (key1->fields.structure[i].centroid
|
||||
!= key2->fields.structure[i].centroid)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -590,6 +590,18 @@ struct glsl_struct_field {
|
|||
* Ignored for structs.
|
||||
*/
|
||||
int location;
|
||||
|
||||
/**
|
||||
* For interface blocks, the interpolation mode (as in
|
||||
* ir_variable::interpolation). 0 otherwise.
|
||||
*/
|
||||
unsigned interpolation:2;
|
||||
|
||||
/**
|
||||
* For interface blocks, 1 if this variable uses centroid interpolation (as
|
||||
* in ir_variable::centroid). 0 otherwise.
|
||||
*/
|
||||
unsigned centroid:1;
|
||||
};
|
||||
|
||||
static inline unsigned int
|
||||
|
|
|
|||
|
|
@ -152,6 +152,9 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
|
|||
}
|
||||
new_var->location = iface_t->fields.structure[i].location;
|
||||
new_var->explicit_location = (new_var->location >= 0);
|
||||
new_var->interpolation =
|
||||
iface_t->fields.structure[i].interpolation;
|
||||
new_var->centroid = iface_t->fields.structure[i].centroid;
|
||||
|
||||
new_var->init_interface_type(iface_t);
|
||||
hash_table_insert(interface_namespace, new_var,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue