nir: Add system values from ARB_shader_ballot

We already had a channel_num system value, which I'm renaming to
subgroup_invocation to match the rest of the new system values.

Note that while ballotARB(true) will return zeros in the high 32-bits on
systems where gl_SubGroupSizeARB <= 32, the gl_SubGroup??MaskARB
variables do not consider whether channels are enabled. See issue (1) of
ARB_shader_ballot.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Matt Turner
2017-06-22 16:37:51 -07:00
parent 636fe4d1c6
commit 43ef75b394
7 changed files with 84 additions and 4 deletions
+1 -1
View File
@@ -4103,7 +4103,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
break;
}
case nir_intrinsic_load_channel_num: {
case nir_intrinsic_load_subgroup_invocation: {
fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_UW);
dest = retype(dest, BRW_REGISTER_TYPE_UD);
const fs_builder allbld8 = bld.group(8, 0).exec_all();
+2 -2
View File
@@ -88,10 +88,10 @@ lower_cs_intrinsics_convert_block(struct lower_intrinsics_state *state,
/* We construct the local invocation index from:
*
* gl_LocalInvocationIndex =
* cs_thread_local_id + channel_num;
* cs_thread_local_id + subgroup_invocation;
*/
nir_ssa_def *thread_local_id = read_thread_local_id(state);
nir_ssa_def *channel = nir_load_channel_num(b);
nir_ssa_def *channel = nir_load_subgroup_invocation(b);
sysval = nir_iadd(b, channel, thread_local_id);
break;
}