glsl: correctly track cross slot component packing
Otherwise we will mix and match mesa's custom cross slot packing
with arb_enhanced_layouts style packing and we won't correctly
handle the size of the vars needed for the mesa custom packing.
The code was working correctly if the shader interface had both
a matching input and output but when we only had one side of
the interface we were only marking a single slot location as
packed.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Fixes: e5122a5543
("glsl: add a NIR based varying linker")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6853
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17550>
This commit is contained in:
parent
00955a644e
commit
7c484b0c1c
|
@ -1620,17 +1620,19 @@ varying_matches_store_locations(struct varying_matches *vm)
|
|||
/* Find locations suitable for native packing via
|
||||
* ARB_enhanced_layouts.
|
||||
*/
|
||||
if (producer_var && consumer_var) {
|
||||
if (vm->enhanced_layouts_enabled) {
|
||||
const struct glsl_type *type =
|
||||
get_varying_type(producer_var, vm->producer_stage);
|
||||
if (vm->enhanced_layouts_enabled) {
|
||||
nir_variable *var = producer_var ? producer_var : consumer_var;
|
||||
unsigned stage = producer_var ? vm->producer_stage : vm->consumer_stage;
|
||||
const struct glsl_type *type =
|
||||
get_varying_type(var, stage);
|
||||
unsigned comp_slots = glsl_get_component_slots(type) + offset;
|
||||
unsigned slots = comp_slots / 4;
|
||||
if (comp_slots % 4)
|
||||
slots += 1;
|
||||
|
||||
if (producer_var && consumer_var) {
|
||||
if (glsl_type_is_array_or_matrix(type) || glsl_type_is_struct(type) ||
|
||||
glsl_type_is_64bit(type)) {
|
||||
unsigned comp_slots = glsl_get_component_slots(type) + offset;
|
||||
unsigned slots = comp_slots / 4;
|
||||
if (comp_slots % 4)
|
||||
slots += 1;
|
||||
|
||||
for (unsigned j = 0; j < slots; j++) {
|
||||
pack_loc[slot + j] = true;
|
||||
}
|
||||
|
@ -1640,9 +1642,11 @@ varying_matches_store_locations(struct varying_matches *vm)
|
|||
} else {
|
||||
loc_type[slot][offset] = type;
|
||||
}
|
||||
} else {
|
||||
for (unsigned j = 0; j < slots; j++) {
|
||||
pack_loc[slot + j] = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pack_loc[slot] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue