diff options
author | Daniel Schürmann <[email protected]> | 2018-03-09 10:27:20 +0100 |
---|---|---|
committer | Connor Abbott <[email protected]> | 2019-06-13 12:44:23 +0000 |
commit | de56ebadceac8499753ba85bb712cd76168f8837 (patch) | |
tree | e65f409a8acaa5d19be242a843dc0f9437882363 /src/compiler | |
parent | 17c2c9cd67797e8e741859015c123b26c4fa293f (diff) |
nir/spirv: add support for the SubgroupVoteKHR SPIR-V capability
This capability is required for the VK_EXT_shader_subgroup_vote extension.
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 4 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_subgroup.c | 20 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index fdcc9fdb96b..fe9fe6932e7 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -3653,6 +3653,7 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode, spv_check_supported(subgroup_basic, cap); break; + case SpvCapabilitySubgroupVoteKHR: case SpvCapabilityGroupNonUniformVote: spv_check_supported(subgroup_vote, cap); break; @@ -4524,6 +4525,9 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode, case SpvOpGroupNonUniformLogicalXor: case SpvOpGroupNonUniformQuadBroadcast: case SpvOpGroupNonUniformQuadSwap: + case SpvOpSubgroupAllKHR: + case SpvOpSubgroupAnyKHR: + case SpvOpSubgroupAllEqualKHR: vtn_handle_subgroup(b, opcode, w, count); break; diff --git a/src/compiler/spirv/vtn_subgroup.c b/src/compiler/spirv/vtn_subgroup.c index 1b066f9340c..dfa8347b292 100644 --- a/src/compiler/spirv/vtn_subgroup.c +++ b/src/compiler/spirv/vtn_subgroup.c @@ -189,18 +189,24 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode, case SpvOpGroupNonUniformAll: case SpvOpGroupNonUniformAny: - case SpvOpGroupNonUniformAllEqual: { + case SpvOpGroupNonUniformAllEqual: + case SpvOpSubgroupAllKHR: + case SpvOpSubgroupAnyKHR: + case SpvOpSubgroupAllEqualKHR: { vtn_fail_if(val->type->type != glsl_bool_type(), "OpGroupNonUniform(All|Any|AllEqual) must return a bool"); nir_intrinsic_op op; switch (opcode) { case SpvOpGroupNonUniformAll: + case SpvOpSubgroupAllKHR: op = nir_intrinsic_vote_all; break; case SpvOpGroupNonUniformAny: + case SpvOpSubgroupAnyKHR: op = nir_intrinsic_vote_any; break; - case SpvOpGroupNonUniformAllEqual: { + case SpvOpGroupNonUniformAllEqual: + case SpvOpSubgroupAllEqualKHR: { switch (glsl_get_base_type(val->type->type)) { case GLSL_TYPE_FLOAT: case GLSL_TYPE_DOUBLE: @@ -222,8 +228,14 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode, unreachable("Unhandled opcode"); } - nir_ssa_def *src0 = vtn_ssa_value(b, w[4])->def; - + nir_ssa_def *src0; + if (opcode == SpvOpGroupNonUniformAll || + opcode == SpvOpGroupNonUniformAny || + opcode == SpvOpGroupNonUniformAllEqual) { + src0 = vtn_ssa_value(b, w[4])->def; + } else { + src0 = vtn_ssa_value(b, w[3])->def; + } nir_intrinsic_instr *intrin = nir_intrinsic_instr_create(b->nb.shader, op); intrin->num_components = src0->num_components; |