diff options
author | Jordan Justen <[email protected]> | 2015-07-28 15:24:13 -0700 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2015-12-09 23:50:38 -0800 |
commit | 8613206bd3dd80dc916b6ce7c47bf59cd4d114c8 (patch) | |
tree | c59b625a039c18a991fc832dbf560723c657a106 /src/mesa/drivers/dri | |
parent | e128a6231870f98930c6634e09eb9c83cf582d4e (diff) |
i965/fs: Handle nir shared variable load intrinsic
v3:
* Remove extra #includes (Iago)
* Use recently added GEN7_BTI_SLM instead of BRW_SLM_SURFACE_INDEX (curro)
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]>
Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index a00fd0e186e..c9da49564a7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -2427,6 +2427,34 @@ 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 = brw_imm_ud(GEN7_BTI_SLM); + + /* Get the offset to read from */ + fs_reg offset_reg; + if (has_indirect) { + offset_reg = get_nir_src(instr->src[0]); + } else { + offset_reg = brw_imm_ud(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: unreachable("Not allowed"); /* fallthrough */ |