[Mesa-dev] [PATCH 25/36] i965/fs: Handle nir shared variable load intrinsic
Jordan Justen
jordan.l.justen at intel.com
Sat Nov 14 13:44:01 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 6484484..e178ce5 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -2851,4 +2851,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