aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_lower_io_to_vector.c
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2020-06-04 12:38:08 +0200
committerMarge Bot <[email protected]>2020-06-15 16:13:58 +0000
commite838acf37d055ba3734d720804b72eb1ecf02577 (patch)
treeeed41673760a7fb1942cec9ba58c1d4676a43b9b /src/compiler/nir/nir_lower_io_to_vector.c
parentb5c810d68b2c1b42209c24f8eff7c69c621995a0 (diff)
nir: do not try to merge xfb-outputs
It's tricky to merge XFB-outputs correctly, because we need there to not be any overlaps when we get to `nir_gather_xfb_info_with_varyings` later on. We currently trigger an assert there if we end up merging here. So let's not even try. This is an optimization, and we can optimize this in safe cases later if needed. For now, let's play it safe. Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5329>
Diffstat (limited to 'src/compiler/nir/nir_lower_io_to_vector.c')
-rw-r--r--src/compiler/nir/nir_lower_io_to_vector.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_io_to_vector.c b/src/compiler/nir/nir_lower_io_to_vector.c
index f85e53ac758..b1ea871a402 100644
--- a/src/compiler/nir/nir_lower_io_to_vector.c
+++ b/src/compiler/nir/nir_lower_io_to_vector.c
@@ -135,6 +135,18 @@ variables_can_merge(const nir_shader *shader,
a->data.index != b->data.index)
return false;
+ /* It's tricky to merge XFB-outputs correctly, because we need there
+ * to not be any overlaps when we get to
+ * nir_gather_xfb_info_with_varyings later on. We'll end up
+ * triggering an assert there if we merge here.
+ */
+ if ((shader->info.stage == MESA_SHADER_VERTEX ||
+ shader->info.stage == MESA_SHADER_TESS_EVAL ||
+ shader->info.stage == MESA_SHADER_GEOMETRY) &&
+ a->data.mode == nir_var_shader_out &&
+ (a->data.explicit_xfb_buffer || b->data.explicit_xfb_buffer))
+ return false;
+
return true;
}