microsoft/compiler: Pick a type that matches interpolation mode for structs

We can't use linear interpolation on integer types, and varyings using
a struct type might actually contain only fp32 members, in which case
interpolation should happen as requested.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16961>
This commit is contained in:
Boris Brezillon
2022-02-15 10:04:33 -08:00
committed by Marge Bot
parent 51bdac4846
commit 69339066fc
3 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ enum dxil_prog_sig_comp_type dxil_get_prog_sig_comp_type(const struct glsl_type
case GLSL_TYPE_UINT64: return DXIL_PROG_SIG_COMP_TYPE_UINT64;
case GLSL_TYPE_INT64: return DXIL_PROG_SIG_COMP_TYPE_SINT64;
case GLSL_TYPE_BOOL: return DXIL_PROG_SIG_COMP_TYPE_UINT32;
case GLSL_TYPE_STRUCT: return DXIL_PROG_SIG_COMP_TYPE_UINT32;
case GLSL_TYPE_STRUCT: return DXIL_PROG_SIG_COMP_TYPE_UNKNOWN;
default:
debug_printf("unexpected type: %s\n", glsl_get_type_name(type));
return DXIL_PROG_SIG_COMP_TYPE_UNKNOWN;
+11 -2
View File
@@ -127,8 +127,17 @@ get_additional_semantic_info(nir_shader *s, nir_variable *var, struct semantic_i
dxil_get_prog_sig_comp_type(type);
bool is_depth = is_depth_output(info->kind);
info->sig_comp_type = glsl_type_is_struct(type) ?
DXIL_COMP_TYPE_U32 : dxil_get_comp_type(type);
if (!glsl_type_is_struct(type)) {
info->sig_comp_type = dxil_get_comp_type(type);
} else if (var->data.interpolation == INTERP_MODE_FLAT) {
info->sig_comp_type = DXIL_COMP_TYPE_U32;
info->comp_type = DXIL_PROG_SIG_COMP_TYPE_UINT32;
} else {
info->sig_comp_type = DXIL_COMP_TYPE_F32;
info->comp_type = DXIL_PROG_SIG_COMP_TYPE_FLOAT32;
}
bool is_gs_input = s->info.stage == MESA_SHADER_GEOMETRY &&
(var->data.mode & (nir_var_shader_in | nir_var_system_value));