microsoft/compiler: When sorting patch varyings, adjust location to be in normal...
authorJesse Natalie <jenatali@microsoft.com>
Mon, 3 Jan 2022 21:33:53 +0000 (13:33 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 26 Jan 2022 01:31:35 +0000 (01:31 +0000)
This way, patch varyings come before the patch sysvals (tess levels).

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14399>

src/microsoft/compiler/dxil_nir.c

index 3b686bc..8ef8c7b 100644 (file)
@@ -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;
 }