diff --git a/src/microsoft/compiler/dxil_module.h b/src/microsoft/compiler/dxil_module.h index 701336ec4bc..13323280d03 100644 --- a/src/microsoft/compiler/dxil_module.h +++ b/src/microsoft/compiler/dxil_module.h @@ -197,7 +197,16 @@ struct dxil_module { struct dxil_signature_record inputs[DXIL_SHADER_MAX_IO_ROWS]; struct dxil_signature_record outputs[DXIL_SHADER_MAX_IO_ROWS]; struct dxil_signature_record patch_consts[DXIL_SHADER_MAX_IO_ROWS]; - unsigned input_mappings[DXIL_SHADER_MAX_IO_ROWS]; + + /* This array is indexed using var->data.driver_location, which + * is not a direct match to IO rows, since a row is a vec4, and + * variables can occupy less than that, and several vars can + * be packed in a row. Hence the x4, but I doubt we can end up + * with more than 80x4 variables in practice. Maybe this array + * should be allocated dynamically based on on the maximum + * driver_location across all input vars. + */ + unsigned input_mappings[DXIL_SHADER_MAX_IO_ROWS * 4]; struct dxil_psv_signature_element psv_inputs[DXIL_SHADER_MAX_IO_ROWS]; struct dxil_psv_signature_element psv_outputs[DXIL_SHADER_MAX_IO_ROWS]; diff --git a/src/microsoft/compiler/dxil_signature.c b/src/microsoft/compiler/dxil_signature.c index 732ad42bf4e..b96e92c14fd 100644 --- a/src/microsoft/compiler/dxil_signature.c +++ b/src/microsoft/compiler/dxil_signature.c @@ -550,11 +550,7 @@ get_input_signature_group(struct dxil_module *mod, const struct dxil_mdnode **in mod->inputs[num_inputs].sysvalue = semantic.sysvalue_name; *row_iter = get_additional_semantic_info(s, var, &semantic, *row_iter, input_clip_size); - if (semantic.start_row >= 0) { - for (unsigned i = 0; i < semantic.rows; ++i) - mod->input_mappings[semantic.start_row + i] = num_inputs; - } - + mod->input_mappings[var->data.driver_location] = num_inputs; mod->inputs[num_inputs].name = ralloc_strdup(mod->ralloc_ctx, semantic.name); mod->inputs[num_inputs].num_elements = semantic.rows;