nir: add new VARYING_SLOTs and shader info for packed 16-bit varyings

This allows mediump inputs and outputs to be trivially lowered into packed
16-bit varyings where 1 slot is occupied by 2 16-bit vec4s, without any
packing instructions in NIR and without any conflicts with 32-bit varyings.

The only thing that is changed is IO semantics in intrinsics to get packed
16-bit varyings.

This simplifies supporting 16-bit types for drivers that have 32-bit slots
everywhere except the fragment shader where they can do 16-bit interpolation
on either the low or high half of each slot.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9050>
This commit is contained in:
Marek Olšák
2021-02-09 10:58:51 -05:00
committed by Marge Bot
parent 5f7c7c9a7f
commit 73f532e5bf
5 changed files with 109 additions and 10 deletions

View File

@@ -985,10 +985,12 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
}
fprintf(fp, ")");
}
if (state->shader->info.stage == MESA_SHADER_FRAGMENT &&
nir_intrinsic_io_semantics(instr).medium_precision) {
if (nir_intrinsic_io_semantics(instr).medium_precision) {
fprintf(fp, " mediump");
}
if (nir_intrinsic_io_semantics(instr).high_16bits) {
fprintf(fp, " high_16bits");
}
}
break;