SPV: Implement the extension SPV_KHR_shader_ballot

This commit is contained in:
Rex Xu 2016-09-21 18:56:12 +08:00
parent 6714bcc2ca
commit 5159664475
8 changed files with 480 additions and 341 deletions

View file

@ -45,14 +45,15 @@
#include <cstring>
#include <algorithm>
#ifdef AMD_EXTENSIONS
namespace spv {
extern "C" {
// Include C-based headers that don't have a namespace
#include "GLSL.ext.KHR.h"
#ifdef AMD_EXTENSIONS
#include "GLSL.ext.AMD.h"
#endif
}
}
#endif
namespace spv {
@ -312,6 +313,12 @@ const char* BuiltInString(int builtIn)
case BuiltInCeiling:
default: return "Bad";
case 4416: return "SubgroupEqMaskKHR";
case 4417: return "SubgroupGeMaskKHR";
case 4418: return "SubgroupGtMaskKHR";
case 4419: return "SubgroupLeMaskKHR";
case 4420: return "SubgroupLtMaskKHR";
#ifdef AMD_EXTENSIONS
case 4992: return "BaryCoordNoPerspAMD";
case 4993: return "BaryCoordNoPerspCentroidAMD";
@ -799,6 +806,8 @@ const char* CapabilityString(int info)
case CapabilityCeiling:
default: return "Bad";
case 4423: return "SubgroupBallotKHR";
}
}
@ -1131,6 +1140,9 @@ const char* OpcodeString(int op)
default:
return "Bad";
case 4421: return "OpSubgroupBallotKHR";
case 4422: return "OpSubgroupFirstInvocationKHR";
#ifdef AMD_EXTENSIONS
case 5000: return "OpGroupIAddNonUniformAMD";
case 5001: return "OpGroupFAddNonUniformAMD";
@ -1146,11 +1158,7 @@ const char* OpcodeString(int op)
// The set of objects that hold all the instruction/operand
// parameterization information.
#ifdef AMD_EXTENSIONS
InstructionParameters InstructionDesc[OpCodeMask + 1];
#else
InstructionParameters InstructionDesc[OpcodeCeiling];
#endif
OperandParameters ExecutionModeOperands[ExecutionModeCeiling];
OperandParameters DecorationOperands[DecorationCeiling];
@ -2742,6 +2750,10 @@ void Parameterize()
InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Wait Events'");
InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Ret Event'");
InstructionDesc[OpSubgroupBallotKHR].operands.push(OperandId, "'Predicate'");
InstructionDesc[OpSubgroupFirstInvocationKHR].operands.push(OperandId, "'Value'");
#ifdef AMD_EXTENSIONS
InstructionDesc[OpGroupIAddNonUniformAMD].capabilities.push_back(CapabilityGroups);
InstructionDesc[OpGroupIAddNonUniformAMD].operands.push(OperandScope, "'Execution'");