break;
}
+ case nir_intrinsic_first_invocation: {
+ fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_UD);
+ bld.exec_all().emit(SHADER_OPCODE_FIND_LIVE_CHANNEL, tmp);
+ bld.MOV(retype(dest, BRW_REGISTER_TYPE_UD),
+ fs_reg(component(tmp, 0)));
+ break;
+ }
+
default:
unreachable("unknown intrinsic");
}
break;
}
+ case nir_intrinsic_load_subgroup_id:
+ if (state->local_workgroup_size > 8)
+ continue;
+
+ /* For small workgroup sizes, we know subgroup_id will be zero */
+ sysval = nir_imm_int(b, 0);
+ break;
+
+ case nir_intrinsic_load_num_subgroups: {
+ unsigned local_workgroup_size =
+ nir->info.cs.local_size[0] * nir->info.cs.local_size[1] *
+ nir->info.cs.local_size[2];
+ unsigned num_subgroups =
+ DIV_ROUND_UP(local_workgroup_size, state->dispatch_width);
+ sysval = nir_imm_int(b, num_subgroups);
+ break;
+ }
+
default:
continue;
}