Implement GLSL_EXT_shader_atomic_float2
This commit is contained in:
parent
a23e143636
commit
d352577a99
9 changed files with 319 additions and 24 deletions
|
|
@ -36,6 +36,8 @@ static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fu
|
|||
static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density";
|
||||
static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_atomic_float_add";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add";
|
||||
static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max";
|
||||
static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64";
|
||||
|
||||
#endif // #ifndef GLSLextEXT_H
|
||||
|
|
|
|||
|
|
@ -6900,13 +6900,17 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
|||
case glslang::EOpImageAtomicAdd:
|
||||
case glslang::EOpAtomicCounterAdd:
|
||||
opCode = spv::OpAtomicIAdd;
|
||||
if (typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
||||
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
||||
opCode = spv::OpAtomicFAddEXT;
|
||||
builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_add);
|
||||
if (typeProxy == glslang::EbtFloat)
|
||||
if (typeProxy == glslang::EbtFloat16) {
|
||||
builder.addExtension(spv::E_SPV_EXT_shader_atomic_float16_add);
|
||||
builder.addCapability(spv::CapabilityAtomicFloat16AddEXT);
|
||||
} else if (typeProxy == glslang::EbtFloat) {
|
||||
builder.addCapability(spv::CapabilityAtomicFloat32AddEXT);
|
||||
else
|
||||
} else {
|
||||
builder.addCapability(spv::CapabilityAtomicFloat64AddEXT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case glslang::EOpAtomicSubtract:
|
||||
|
|
@ -6916,14 +6920,38 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
|
|||
case glslang::EOpAtomicMin:
|
||||
case glslang::EOpImageAtomicMin:
|
||||
case glslang::EOpAtomicCounterMin:
|
||||
opCode = (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) ?
|
||||
spv::OpAtomicUMin : spv::OpAtomicSMin;
|
||||
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
||||
opCode = spv::OpAtomicFMinEXT;
|
||||
builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_min_max);
|
||||
if (typeProxy == glslang::EbtFloat16)
|
||||
builder.addCapability(spv::CapabilityAtomicFloat16MinMaxEXT);
|
||||
else if (typeProxy == glslang::EbtFloat)
|
||||
builder.addCapability(spv::CapabilityAtomicFloat32MinMaxEXT);
|
||||
else
|
||||
builder.addCapability(spv::CapabilityAtomicFloat64MinMaxEXT);
|
||||
} else if (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) {
|
||||
opCode = spv::OpAtomicUMin;
|
||||
} else {
|
||||
opCode = spv::OpAtomicSMin;
|
||||
}
|
||||
break;
|
||||
case glslang::EOpAtomicMax:
|
||||
case glslang::EOpImageAtomicMax:
|
||||
case glslang::EOpAtomicCounterMax:
|
||||
opCode = (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) ?
|
||||
spv::OpAtomicUMax : spv::OpAtomicSMax;
|
||||
if (typeProxy == glslang::EbtFloat16 || typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble) {
|
||||
opCode = spv::OpAtomicFMaxEXT;
|
||||
builder.addExtension(spv::E_SPV_EXT_shader_atomic_float_min_max);
|
||||
if (typeProxy == glslang::EbtFloat16)
|
||||
builder.addCapability(spv::CapabilityAtomicFloat16MinMaxEXT);
|
||||
else if (typeProxy == glslang::EbtFloat)
|
||||
builder.addCapability(spv::CapabilityAtomicFloat32MinMaxEXT);
|
||||
else
|
||||
builder.addCapability(spv::CapabilityAtomicFloat64MinMaxEXT);
|
||||
} else if (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) {
|
||||
opCode = spv::OpAtomicUMax;
|
||||
} else {
|
||||
opCode = spv::OpAtomicSMax;
|
||||
}
|
||||
break;
|
||||
case glslang::EOpAtomicAnd:
|
||||
case glslang::EOpImageAtomicAnd:
|
||||
|
|
|
|||
|
|
@ -966,8 +966,12 @@ const char* CapabilityString(int info)
|
|||
|
||||
case CapabilityIntegerFunctions2INTEL: return "CapabilityIntegerFunctions2INTEL";
|
||||
|
||||
case CapabilityAtomicFloat16AddEXT: return "AtomicFloat16AddEXT";
|
||||
case CapabilityAtomicFloat32AddEXT: return "AtomicFloat32AddEXT";
|
||||
case CapabilityAtomicFloat64AddEXT: return "AtomicFloat64AddEXT";
|
||||
case CapabilityAtomicFloat16MinMaxEXT: return "AtomicFloat16MinMaxEXT";
|
||||
case CapabilityAtomicFloat32MinMaxEXT: return "AtomicFloat32MinMaxEXT";
|
||||
case CapabilityAtomicFloat64MinMaxEXT: return "AtomicFloat64MinMaxEXT";
|
||||
|
||||
case CapabilityWorkgroupMemoryExplicitLayoutKHR: return "CapabilityWorkgroupMemoryExplicitLayoutKHR";
|
||||
case CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR: return "CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR";
|
||||
|
|
@ -1352,6 +1356,8 @@ const char* OpcodeString(int op)
|
|||
case 4432: return "OpSubgroupReadInvocationKHR";
|
||||
|
||||
case OpAtomicFAddEXT: return "OpAtomicFAddEXT";
|
||||
case OpAtomicFMinEXT: return "OpAtomicFMinEXT";
|
||||
case OpAtomicFMaxEXT: return "OpAtomicFMaxEXT";
|
||||
|
||||
case 5000: return "OpGroupIAddNonUniformAMD";
|
||||
case 5001: return "OpGroupFAddNonUniformAMD";
|
||||
|
|
@ -2342,6 +2348,16 @@ void Parameterize()
|
|||
InstructionDesc[OpAtomicSMax].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicSMax].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicFMinEXT].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
InstructionDesc[OpAtomicFMaxEXT].operands.push(OperandId, "'Value'");
|
||||
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandScope, "'Scope'");
|
||||
InstructionDesc[OpAtomicAnd].operands.push(OperandMemorySemantics, "'Semantics'");
|
||||
|
|
|
|||
|
|
@ -410,6 +410,7 @@ enum FPRoundingMode {
|
|||
enum LinkageType {
|
||||
LinkageTypeExport = 0,
|
||||
LinkageTypeImport = 1,
|
||||
LinkageTypeLinkOnceODR = 2,
|
||||
LinkageTypeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
|
@ -1011,8 +1012,12 @@ enum Capability {
|
|||
CapabilityFunctionPointersINTEL = 5603,
|
||||
CapabilityIndirectReferencesINTEL = 5604,
|
||||
CapabilityAsmINTEL = 5606,
|
||||
CapabilityAtomicFloat32MinMaxEXT = 5612,
|
||||
CapabilityAtomicFloat64MinMaxEXT = 5613,
|
||||
CapabilityAtomicFloat16MinMaxEXT = 5616,
|
||||
CapabilityVectorComputeINTEL = 5617,
|
||||
CapabilityVectorAnyINTEL = 5619,
|
||||
CapabilityExpectAssumeKHR = 5629,
|
||||
CapabilitySubgroupAvcMotionEstimationINTEL = 5696,
|
||||
CapabilitySubgroupAvcMotionEstimationIntraINTEL = 5697,
|
||||
CapabilitySubgroupAvcMotionEstimationChromaINTEL = 5698,
|
||||
|
|
@ -1036,6 +1041,7 @@ enum Capability {
|
|||
CapabilityAtomicFloat32AddEXT = 6033,
|
||||
CapabilityAtomicFloat64AddEXT = 6034,
|
||||
CapabilityLongConstantCompositeINTEL = 6089,
|
||||
CapabilityAtomicFloat16AddEXT = 6095,
|
||||
CapabilityMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
|
@ -1103,15 +1109,15 @@ enum FragmentShadingRateMask {
|
|||
};
|
||||
|
||||
enum FPDenormMode {
|
||||
FPDenormModePreserve = 0,
|
||||
FPDenormModeFlushToZero = 1,
|
||||
FPDenormModeMax = 0x7fffffff,
|
||||
FPDenormModePreserve = 0,
|
||||
FPDenormModeFlushToZero = 1,
|
||||
FPDenormModeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum FPOperationMode {
|
||||
FPOperationModeIEEE = 0,
|
||||
FPOperationModeALT = 1,
|
||||
FPOperationModeMax = 0x7fffffff,
|
||||
FPOperationModeIEEE = 0,
|
||||
FPOperationModeALT = 1,
|
||||
FPOperationModeMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
enum Op {
|
||||
|
|
@ -1538,6 +1544,10 @@ enum Op {
|
|||
OpAsmTargetINTEL = 5609,
|
||||
OpAsmINTEL = 5610,
|
||||
OpAsmCallINTEL = 5611,
|
||||
OpAtomicFMinEXT = 5614,
|
||||
OpAtomicFMaxEXT = 5615,
|
||||
OpAssumeTrueKHR = 5630,
|
||||
OpExpectKHR = 5631,
|
||||
OpDecorateString = 5632,
|
||||
OpDecorateStringGOOGLE = 5632,
|
||||
OpMemberDecorateString = 5633,
|
||||
|
|
@ -2120,6 +2130,10 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpAsmTargetINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAsmINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAsmCallINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAtomicFMinEXT: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAtomicFMaxEXT: *hasResult = true; *hasResultType = true; break;
|
||||
case OpAssumeTrueKHR: *hasResult = false; *hasResultType = false; break;
|
||||
case OpExpectKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpDecorateString: *hasResult = false; *hasResultType = false; break;
|
||||
case OpMemberDecorateString: *hasResult = false; *hasResultType = false; break;
|
||||
case OpVmeImageINTEL: *hasResult = true; *hasResultType = true; break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue