microsoft/compiler: More robustly handle setting Register=-1

This is the 'N/A mask' case in the DXIL disassembly.

This logic is taken from: 7c9e487afd/tools/clang/tools/dxcompiler/dxcdisassembler.cpp (L106)

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12513>
This commit is contained in:
Michael Tang 2021-08-23 18:48:50 -07:00 committed by Marge Bot
parent 62c3492d0b
commit 88220083cf

View file

@ -50,8 +50,8 @@ struct semantic_info {
static bool
is_depth_output(enum dxil_semantic_kind kind)
{
return kind == DXIL_SEM_DEPTH ||
kind == DXIL_SEM_STENCIL_REF;
return kind == DXIL_SEM_DEPTH || kind == DXIL_SEM_DEPTH_GE ||
kind == DXIL_SEM_DEPTH_LE || kind == DXIL_SEM_STENCIL_REF;
}
static uint8_t
@ -111,7 +111,11 @@ 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;
} else if (is_depth || (info->kind == DXIL_SEM_PRIMITIVE_ID && is_gs_shader)) {
} else if (is_depth ||
(info->kind == DXIL_SEM_PRIMITIVE_ID && is_gs_shader) ||
info->kind == DXIL_SEM_COVERAGE ||
info->kind == DXIL_SEM_SAMPLE_INDEX) {
// This turns into a 'N/A' mask in the disassembly
info->start_row = -1;
} else if (var->data.compact) {
if (var->data.location_frac) {