Merge pull request #679 from ashwinkolhe/akolhe_spv_khr_subgroup_vote

Implement SPV_KHR_subgroup_vote
This commit is contained in:
John Kessenich
2017-01-19 16:16:49 -07:00
committed by GitHub
5 changed files with 50 additions and 34 deletions

View File

@@ -4148,6 +4148,11 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
op == glslang::EOpReadInvocation) {
builder.addExtension(spv::E_SPV_KHR_shader_ballot);
builder.addCapability(spv::CapabilitySubgroupBallotKHR);
} else if (op == glslang::EOpAnyInvocation ||
op == glslang::EOpAllInvocations ||
op == glslang::EOpAllInvocationsEqual) {
builder.addExtension(spv::E_SPV_KHR_subgroup_vote);
builder.addCapability(spv::CapabilitySubgroupVoteKHR);
} else {
builder.addCapability(spv::CapabilityGroups);
#ifdef AMD_EXTENSIONS
@@ -4202,20 +4207,14 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op
switch (op) {
case glslang::EOpAnyInvocation:
opCode = spv::OpGroupAny;
opCode = spv::OpSubgroupAnyKHR;
break;
case glslang::EOpAllInvocations:
opCode = spv::OpGroupAll;
opCode = spv::OpSubgroupAllKHR;
break;
case glslang::EOpAllInvocationsEqual:
{
spv::Id groupAll = builder.createOp(spv::OpGroupAll, typeId, spvGroupOperands);
spv::Id groupAny = builder.createOp(spv::OpGroupAny, typeId, spvGroupOperands);
return builder.createBinOp(spv::OpLogicalOr, typeId, groupAll,
builder.createUnaryOp(spv::OpLogicalNot, typeId, groupAny));
}
opCode = spv::OpSubgroupAllEqualKHR;
break;
case glslang::EOpReadInvocation:
opCode = spv::OpSubgroupReadInvocationKHR;
if (builder.isVectorType(typeId))