Mesa (master): nir: add const_index parameters to system value builder function
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 14 01:16:48 UTC 2018
Module: Mesa
Branch: master
Commit: 80db331c2d477f8f4bc5c2b0373573f505f676e5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=80db331c2d477f8f4bc5c2b0373573f505f676e5
Author: Karol Herbst <kherbst at redhat.com>
Date: Thu Jul 19 11:42:08 2018 +0200
nir: add const_index parameters to system value builder function
this allows to replace some nir_load_system_value calls with the specific
system value constructor
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
src/compiler/nir/nir_builder_opcodes_h.py | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_builder_opcodes_h.py b/src/compiler/nir/nir_builder_opcodes_h.py
index e600093e9f..34b8c4371e 100644
--- a/src/compiler/nir/nir_builder_opcodes_h.py
+++ b/src/compiler/nir/nir_builder_opcodes_h.py
@@ -55,11 +55,28 @@ nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index)
return &load->dest.ssa;
}
+<%
+def sysval_decl_list(opcode):
+ res = ''
+ if opcode.indices:
+ res += ', unsigned ' + opcode.indices[0].lower()
+ return res
+
+def sysval_arg_list(opcode):
+ args = []
+ if opcode.indices:
+ args.append(opcode.indices[0].lower())
+ else:
+ args.append('0')
+ return ', '.join(args)
+%>
+
% for name, opcode in filter(lambda v: v[1].sysval, sorted(INTR_OPCODES.items())):
static inline nir_ssa_def *
-nir_${name}(nir_builder *build)
+nir_${name}(nir_builder *build${sysval_decl_list(opcode)})
{
- return nir_load_system_value(build, nir_intrinsic_${name}, 0);
+ return nir_load_system_value(build, nir_intrinsic_${name},
+ ${sysval_arg_list(opcode)});
}
% endfor
More information about the mesa-commit
mailing list