summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2016-05-22 16:33:44 -0700
committerJordan Justen <jordan.l.justen@intel.com>2016-05-23 10:15:25 -0700
commit6717700397a44aaa7cd76b56c6cc9831e0537643 (patch)
tree1390201faccdbc774b207f7b7730dc1a3cd42fef
parent27c84fe751511122702edefe4f2a49d353ea87f5 (diff)
i965: Add nir channel_num system value
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
-rw-r--r--src/compiler/nir/nir_intrinsics.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp14
2 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_intrinsics.h b/src/compiler/nir/nir_intrinsics.h
index aeb6038267..6f86c9f95f 100644
--- a/src/compiler/nir/nir_intrinsics.h
+++ b/src/compiler/nir/nir_intrinsics.h
@@ -304,6 +304,7 @@ SYSTEM_VALUE(work_group_id, 3, 0, xx, xx, xx)
SYSTEM_VALUE(user_clip_plane, 4, 1, UCP_ID, xx, xx)
SYSTEM_VALUE(num_work_groups, 3, 0, xx, xx, xx)
SYSTEM_VALUE(helper_invocation, 1, 0, xx, xx, xx)
+SYSTEM_VALUE(channel_num, 1, 0, xx, xx, xx)
/*
* Load operations pull data from some piece of GPU memory. All load
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 2e8d8af9be..95f6281288 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -3880,6 +3880,20 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
break;
}
+ case nir_intrinsic_load_channel_num: {
+ const fs_builder bld8 = bld.group(8, 0);
+ fs_reg word_channels = bld.vgrf(BRW_REGISTER_TYPE_UW);
+ dest = retype(dest, BRW_REGISTER_TYPE_UD);
+ bld8.MOV(word_channels, brw_imm_uv(0x76543210));
+ if (dispatch_width > 8) {
+ bld8.MOV(byte_offset(word_channels, 16), brw_imm_uv(0xfedcba98));
+ }
+ bld.MOV(dest, word_channels);
+ if (dispatch_width > 16)
+ unreachable("Support SIMD32 for channel_num is missing");
+ break;
+ }
+
default:
unreachable("unknown intrinsic");
}