r600/sfn: Add methods to valuepool to get a vector of values
authorGert Wollny <gert.wollny@collabora.com>
Sun, 12 Apr 2020 15:05:48 +0000 (17:05 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Apr 2020 08:06:33 +0000 (08:06 +0000)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4714>

src/gallium/drivers/r600/sfn/sfn_valuepool.cpp
src/gallium/drivers/r600/sfn/sfn_valuepool.h

index 79c83d82859c005afbfa0c465c3769e4c3a818c9..8ce378b43b3ad6dda5bb9fe8e3802e66fcaa73a3 100644 (file)
@@ -53,9 +53,28 @@ GPRVector ValuePool::vec_from_nir(const nir_dest& dst, int num_components)
    for (int i = 0; i < 4; ++i)
       result[i] = from_nir(dst, i < num_components ? i : 7);
    return GPRVector(result);
+}
+
+std::vector<PValue> ValuePool::varvec_from_nir(const nir_dest& dst, int num_components)
+{
+   std::vector<PValue> result(num_components);
+   for (int i = 0; i < num_components; ++i)
+      result[i] = from_nir(dst, i);
+   return result;
+}
 
+
+std::vector<PValue> ValuePool::varvec_from_nir(const nir_src& src, int num_components)
+{
+   std::vector<PValue> result(num_components);
+   int i;
+   for (i = 0; i < num_components; ++i)
+      result[i] = from_nir(src, i);
+
+   return result;
 }
 
+
 PValue ValuePool::from_nir(const nir_src& v, unsigned component, unsigned swizzled)
 {
    sfn_log << SfnLog::reg << "Search " << (v.is_ssa ? "ssa_reg " : "reg ")
index 4dcdc2c78d483d23aab8b4b36b7b069e6b68349c..acb0454597433a555fe9641a17992f8b081c0f84 100644 (file)
@@ -89,6 +89,9 @@ public:
 
    GPRVector vec_from_nir(const nir_dest& dst, int num_components);
 
+   std::vector<PValue> varvec_from_nir(const nir_dest& src, int num_components);
+   std::vector<PValue> varvec_from_nir(const nir_src& src, int num_components);
+
    PValue from_nir(const nir_src& v, unsigned component, unsigned swizzled);
 
    PValue from_nir(const nir_src& v, unsigned component);