microsoft/compiler: Overlap patch and non-patch varyings so both are separately 0...
authorJesse Natalie <jenatali@microsoft.com>
Sun, 2 Jan 2022 18:15:58 +0000 (10:15 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 26 Jan 2022 01:31:35 +0000 (01:31 +0000)
Also add tess factors to the list of sysvals that can cause vars to be sorted last.

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
src/microsoft/compiler/nir_to_dxil.c

index 9d3fc9f..3b686bc 100644 (file)
@@ -1792,10 +1792,13 @@ dxil_reassign_driver_locations(nir_shader* s, nir_variable_mode modes,
    nir_sort_variables_with_modes(s, variable_location_cmp, modes);
 
    uint64_t result = 0;
-   unsigned driver_loc = 0;
+   unsigned driver_loc = 0, driver_patch_loc = 0;
    nir_foreach_variable_with_modes(var, s, modes) {
-      result |= 1ull << var->data.location;
-      var->data.driver_location = driver_loc++;
+      if (var->data.location < 64)
+         result |= 1ull << var->data.location;
+      /* Overlap patches with non-patch */
+      var->data.driver_location = var->data.patch ?
+         driver_patch_loc++ : driver_loc++;
    }
    return result;
 }
index d24f804..c3cf696 100644 (file)
@@ -5511,6 +5511,8 @@ nir_var_to_dxil_sysvalue_type(nir_variable *var, uint64_t other_stage_mask)
    case VARYING_SLOT_CLIP_DIST0:
    case VARYING_SLOT_CLIP_DIST1:
    case VARYING_SLOT_PSIZ:
+   case VARYING_SLOT_TESS_LEVEL_INNER:
+   case VARYING_SLOT_TESS_LEVEL_OUTER:
       if (!((1ull << var->data.location) & other_stage_mask))
          return DXIL_SYSVALUE;
       FALLTHROUGH;