microsoft/compiler: Support fp16 i/o vars

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Reviewed-by: Michael Tang <tangm@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10063>
This commit is contained in:
Jesse Natalie 2021-04-05 13:22:16 -07:00 committed by Marge Bot
parent 79bcefa8d9
commit bd219321a5
3 changed files with 8 additions and 4 deletions

View file

@ -152,6 +152,7 @@ static const char *overload_str[DXIL_NUM_OVERLOADS] = {
[DXIL_I16] = "i16",
[DXIL_I32] = "i32",
[DXIL_I64] = "i64",
[DXIL_F16] = "f16",
[DXIL_F32] = "f32",
[DXIL_F64] = "f64",
};

View file

@ -680,6 +680,7 @@ dxil_get_overload_type(struct dxil_module *mod, enum overload_type overload)
case DXIL_I16: return get_int16_type(mod);
case DXIL_I32: return get_int32_type(mod);
case DXIL_I64: return get_int64_type(mod);
case DXIL_F16: return get_float16_type(mod);
case DXIL_F32: return get_float32_type(mod);
case DXIL_F64: return get_float64_type(mod);
default:

View file

@ -2457,9 +2457,11 @@ emit_store_output(struct ntd_context *ctx, nir_intrinsic_instr *intr,
nir_variable *output)
{
nir_alu_type out_type = nir_get_nir_type_for_glsl_base_type(glsl_get_base_type(output->type));
enum overload_type overload = DXIL_F32;
if (output->data.compact)
out_type = nir_type_float;
enum overload_type overload = get_overload(out_type, 32);
else
overload = get_overload(out_type, glsl_get_bit_size(output->type));
const struct dxil_func *func = dxil_get_function(&ctx->mod, "dx.op.storeOutput", overload);
if (!func)
@ -2529,7 +2531,7 @@ emit_load_input_array(struct ntd_context *ctx, nir_intrinsic_instr *intr, nir_va
}
nir_alu_type out_type = nir_get_nir_type_for_glsl_base_type(glsl_get_base_type(glsl_get_array_element(var->type)));
enum overload_type overload = get_overload(out_type, 32);
enum overload_type overload = get_overload(out_type, glsl_get_bit_size(glsl_get_array_element(var->type)));
const struct dxil_func *func = dxil_get_function(&ctx->mod, "dx.op.loadInput", overload);
@ -2605,7 +2607,7 @@ emit_load_input_interpolated(struct ntd_context *ctx, nir_intrinsic_instr *intr,
const struct dxil_value *vertex_id = dxil_module_get_undef(&ctx->mod, int32_type);
nir_alu_type out_type = nir_get_nir_type_for_glsl_base_type(glsl_get_base_type(var->type));
enum overload_type overload = get_overload(out_type, 32);
enum overload_type overload = get_overload(out_type, glsl_get_bit_size(var->type));
const struct dxil_func *func = dxil_get_function(&ctx->mod, "dx.op.loadInput", overload);
@ -2636,7 +2638,7 @@ emit_load_input_flat(struct ntd_context *ctx, nir_intrinsic_instr *intr, nir_var
const struct dxil_value *vertex_id = dxil_module_get_int8_const(&ctx->mod, ctx->opts->provoking_vertex);
nir_alu_type out_type = nir_get_nir_type_for_glsl_base_type(glsl_get_base_type(var->type));
enum overload_type overload = get_overload(out_type, 32);
enum overload_type overload = get_overload(out_type, glsl_get_bit_size(var->type));
const struct dxil_func *func = dxil_get_function(&ctx->mod, "dx.op.attributeAtVertex", overload);
if (!func)