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:
@@ -116,6 +116,20 @@ convert_block(nir_block *block, nir_builder *b)
|
||||
nir_load_base_instance(b));
|
||||
break;
|
||||
|
||||
case SYSTEM_VALUE_SUBGROUP_EQ_MASK:
|
||||
case SYSTEM_VALUE_SUBGROUP_GE_MASK:
|
||||
case SYSTEM_VALUE_SUBGROUP_GT_MASK:
|
||||
case SYSTEM_VALUE_SUBGROUP_LE_MASK:
|
||||
case SYSTEM_VALUE_SUBGROUP_LT_MASK: {
|
||||
nir_intrinsic_op op =
|
||||
nir_intrinsic_from_system_value(var->data.location);
|
||||
nir_intrinsic_instr *load = nir_intrinsic_instr_create(b->shader, op);
|
||||
nir_ssa_dest_init(&load->instr, &load->dest, 1, 64, NULL);
|
||||
nir_builder_instr_insert(b, &load->instr);
|
||||
sysval = &load->dest.ssa;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user