[Mesa-dev] [PATCH v2 27/42] i965/fs: Handle nir shared variable load intrinsic
Jordan Justen
jordan.l.justen at intel.com
Tue Nov 17 21:54:59 PST 2015
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/mesa/drivers/dri/i965/brw_defines.h | 2 ++
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 33 ++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index ade3ede..8189c08 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -2867,4 +2867,6 @@ enum brw_wm_barycentric_interp_mode {
# define GPGPU_WALKER_THREAD_WIDTH_MAX_SHIFT 0
# define GPGPU_WALKER_THREAD_WIDTH_MAX_MASK INTEL_MASK(5, 0)
+#define BRW_SLM_SURFACE_INDEX 0xfe
+
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index c282f83..e9336fd 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -33,6 +33,9 @@
#include "brw_fs_surface_builder.h"
#include "brw_vec4_gs_visitor.h"
+#include "brw_fs_builder.h"
+#include "brw_fs_surface_builder.h"
+
using namespace brw;
using namespace brw::surface_access;
@@ -2297,6 +2300,36 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
break;
}
+ case nir_intrinsic_load_shared_indirect:
+ has_indirect = true;
+ /* fallthrough */
+ case nir_intrinsic_load_shared: {
+ assert(devinfo->gen >= 7);
+
+ fs_reg surf_index;
+ unsigned index = BRW_SLM_SURFACE_INDEX;
+ surf_index = fs_reg(index);
+
+ /* Get the offset to read from */
+ fs_reg offset_reg;
+ if (has_indirect) {
+ offset_reg = get_nir_src(instr->src[0]);
+ } else {
+ offset_reg = fs_reg(instr->const_index[0]);
+ }
+
+ /* Read the vector */
+ fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg,
+ 1 /* dims */,
+ instr->num_components,
+ BRW_PREDICATE_NONE);
+ read_result.type = dest.type;
+ for (int i = 0; i < instr->num_components; i++)
+ bld.MOV(offset(dest, bld, i), offset(read_result, bld, i));
+
+ break;
+ }
+
case nir_intrinsic_load_input_indirect:
has_indirect = true;
/* fallthrough */
--
2.6.2
More information about the mesa-dev
mailing list