summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_intrinsics.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-08-22 18:44:51 -0700
committerJason Ekstrand <[email protected]>2017-11-07 10:37:52 -0800
commita026458020e947cc5d864cfb5b19660836b2d613 (patch)
treed6714e0bde4f342c64239d75631a446e71dea98e /src/compiler/nir/nir_opt_intrinsics.c
parent8c2bf020fd649957597d074cf2390d6de029ddd0 (diff)
nir/lower_subgroups: Lower ballot intrinsics to the specified bit size
Ballot intrinsics return a bitfield of subgroups. In GLSL and some SPIR-V extensions, they return a uint64_t. In SPV_KHR_shader_ballot, they return a uvec4. Also, some back-ends would rather pass around 32-bit values because it's easier than messing with 64-bit all the time. To solve this mess, we make nir_lower_subgroups take a new parameter called ballot_bit_size and it lowers whichever thing it gets in from the source language (uint64_t or uvec4) to a scalar with the specified number of bits. This replaces a chunk of the old lowering code. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opt_intrinsics.c')
-rw-r--r--src/compiler/nir/nir_opt_intrinsics.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/compiler/nir/nir_opt_intrinsics.c b/src/compiler/nir/nir_opt_intrinsics.c
index 98c8b1a01e8..eb394af0c10 100644
--- a/src/compiler/nir/nir_opt_intrinsics.c
+++ b/src/compiler/nir/nir_opt_intrinsics.c
@@ -54,24 +54,6 @@ opt_intrinsics_impl(nir_function_impl *impl)
if (nir_src_as_const_value(intrin->src[0]))
replacement = nir_imm_int(&b, NIR_TRUE);
break;
- case nir_intrinsic_ballot: {
- assert(b.shader->options->max_subgroup_size != 0);
- if (b.shader->options->max_subgroup_size > 32 ||
- intrin->dest.ssa.bit_size <= 32)
- continue;
-
- nir_intrinsic_instr *ballot =
- nir_intrinsic_instr_create(b.shader, nir_intrinsic_ballot);
- nir_ssa_dest_init(&ballot->instr, &ballot->dest, 1, 32, NULL);
- nir_src_copy(&ballot->src[0], &intrin->src[0], ballot);
-
- nir_builder_instr_insert(&b, &ballot->instr);
-
- replacement = nir_pack_64_2x32_split(&b,
- &ballot->dest.ssa,
- nir_imm_int(&b, 0));
- break;
- }
default:
break;
}