microsoft/compiler: Don't declare PS output registers split across variables

DXIL doesn't support that. Color targets need to be float4s.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26156>
This commit is contained in:
Jesse Natalie 2023-11-09 09:00:43 -08:00 committed by Marge Bot
parent adc7caa3ec
commit 2334ff67b7
2 changed files with 13 additions and 3 deletions

View file

@ -1503,7 +1503,10 @@ dxil_sort_ps_outputs(nir_shader* s)
unsigned driver_loc = 0;
nir_foreach_variable_with_modes(var, s, nir_var_shader_out) {
var->data.driver_location = driver_loc++;
/* Fractional vars should use the same driver_location as the base. These will
* get fully merged during signature processing.
*/
var->data.driver_location = var->data.location_frac ? driver_loc - 1 : driver_loc++;
}
}

View file

@ -147,7 +147,7 @@ get_additional_semantic_info(nir_shader *s, nir_variable *var, struct semantic_i
info->rows = 1;
if (info->kind == DXIL_SEM_TARGET) {
info->start_row = info->index;
info->cols = (uint8_t)glsl_get_components(type);
info->cols = 4;
} else if (is_depth ||
(info->kind == DXIL_SEM_PRIMITIVE_ID && is_gs_input) ||
info->kind == DXIL_SEM_COVERAGE ||
@ -654,8 +654,15 @@ process_output_signature(struct dxil_module *mod, nir_shader *s)
mod->outputs[num_outputs].sysvalue = out_sysvalue_name(var);
}
nir_variable *base_var = var;
if (var->data.location_frac)
if (var->data.location_frac) {
if (s->info.stage == MESA_SHADER_FRAGMENT) {
/* Fragment shader outputs are all either scalars, or must be declared as a single 4-component vector.
* Any attempt to declare partial vectors split across multiple variables is ignored.
*/
continue;
}
base_var = nir_find_variable_with_location(s, nir_var_shader_out, var->data.location);
}
if (base_var != var &&
base_var->data.stream == var->data.stream)
/* Combine fractional vars into any already existing row */