Module: Mesa Branch: main Commit: 2334ff67b70b737f6debe321d4c3daa399bd9c01 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2334ff67b70b737f6debe321d4c3daa399bd9c01
Author: Jesse Natalie <[email protected]> Date: Thu Nov 9 09:00:43 2023 -0800 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> --- src/microsoft/compiler/dxil_nir.c | 5 ++++- src/microsoft/compiler/dxil_signature.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/microsoft/compiler/dxil_nir.c b/src/microsoft/compiler/dxil_nir.c index cf8f84a7eff..9e5f6cb6997 100644 --- a/src/microsoft/compiler/dxil_nir.c +++ b/src/microsoft/compiler/dxil_nir.c @@ -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++; } } diff --git a/src/microsoft/compiler/dxil_signature.c b/src/microsoft/compiler/dxil_signature.c index a4be1e18f6d..260ca66f590 100644 --- a/src/microsoft/compiler/dxil_signature.c +++ b/src/microsoft/compiler/dxil_signature.c @@ -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 */
