From 8e42891f69a5e6135f41c31995385d50247a8f91 Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Mon, 3 Jan 2022 13:33:53 -0800 Subject: [PATCH] microsoft/compiler: When sorting patch varyings, adjust location to be in normal varying range This way, patch varyings come before the patch sysvals (tess levels). Reviewed-by: Boris Brezillon Reviewed-by: Bill Kristiansen Part-of: --- src/microsoft/compiler/dxil_nir.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/microsoft/compiler/dxil_nir.c b/src/microsoft/compiler/dxil_nir.c index 3b686bc0e2a..8ef8c7b1f46 100644 --- a/src/microsoft/compiler/dxil_nir.c +++ b/src/microsoft/compiler/dxil_nir.c @@ -1723,10 +1723,16 @@ static int variable_location_cmp(const nir_variable* a, const nir_variable* b) { // Sort by driver_location, location, then index + unsigned a_location = a->data.location; + if (a_location >= VARYING_SLOT_PATCH0) + a_location -= VARYING_SLOT_PATCH0; + unsigned b_location = b->data.location; + if (b_location >= VARYING_SLOT_PATCH0) + b_location -= VARYING_SLOT_PATCH0; return a->data.driver_location != b->data.driver_location ? a->data.driver_location - b->data.driver_location : - a->data.location != b->data.location ? - a->data.location - b->data.location : + a_location != b_location ? + a_location - b_location : a->data.index - b->data.index; }