Mesa (master): nir: When nir_lower_vars_to_explicit_types is run on temps, update scratch_size
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jul 14 18:30:54 UTC 2020
Module: Mesa
Branch: master
Commit: 99aaf0ec181efc5830deaeb7ec3331642125bc38
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=99aaf0ec181efc5830deaeb7ec3331642125bc38
Author: Jesse Natalie <jenatali at microsoft.com>
Date: Tue May 26 12:20:20 2020 -0700
nir: When nir_lower_vars_to_explicit_types is run on temps, update scratch_size
To allow interop with other scratch ops, append any remaining temp vars
to the end of any already-allocated scratch space.
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5889>
---
src/compiler/nir/nir_lower_io.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index 70474f18852..be18f79cdc0 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -1431,7 +1431,18 @@ lower_vars_to_explicit(nir_shader *shader,
glsl_type_size_align_func type_info)
{
bool progress = false;
- unsigned offset = 0;
+ unsigned offset;
+ switch (mode) {
+ case nir_var_function_temp:
+ case nir_var_shader_temp:
+ offset = shader->scratch_size;
+ break;
+ case nir_var_mem_shared:
+ offset = 0;
+ break;
+ default:
+ unreachable("Unsupported mode");
+ }
nir_foreach_variable(var, vars) {
unsigned size, align;
const struct glsl_type *explicit_type =
@@ -1446,9 +1457,17 @@ lower_vars_to_explicit(nir_shader *shader,
offset = var->data.driver_location + size;
}
- if (mode == nir_var_mem_shared) {
+ switch (mode) {
+ case nir_var_shader_temp:
+ case nir_var_function_temp:
+ shader->scratch_size = offset;
+ break;
+ case nir_var_mem_shared:
shader->info.cs.shared_size = offset;
shader->num_shared = offset;
+ break;
+ default:
+ unreachable("Unsupported mode");
}
return progress;
More information about the mesa-commit
mailing list