Add support for spirv1.6

Add command line support which enables the following behavior:

- Remap discard

  Map discard to DemoteToHelperInvocation for HLSL shaders. Map to
  OpTerminateInvocation for GLSL shaders.

- Decorate HelperInvocation with Volatile

- Use localSizeId for execution mode

  WorkGroupSize is deprecated in spirv1.6

Also update known goods to SPIRV 1.6
This commit is contained in:
Greg Fischer 2021-09-02 17:37:39 -06:00
parent a0f98ad401
commit 7a49192d23
19 changed files with 556 additions and 218 deletions

View File

@ -1664,9 +1664,22 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
case EShLangCompute:
builder.addCapability(spv::CapabilityShader);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
std::vector<spv::Id> dimConstId;
for (int dim = 0; dim < 3; ++dim) {
bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet);
dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst));
if (specConst) {
builder.addDecoration(dimConstId.back(), spv::DecorationSpecId,
glslangIntermediate->getLocalSizeSpecId(dim));
}
}
builder.addExecutionModeId(shaderEntry, spv::ExecutionModeLocalSizeId, dimConstId);
} else {
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
}
if (glslangIntermediate->getLayoutDerivativeModeNone() == glslang::LayoutDerivativeGroupQuads) {
builder.addCapability(spv::CapabilityComputeDerivativeGroupQuadsNV);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeDerivativeGroupQuadsNV);
@ -1770,9 +1783,22 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
case EShLangMeshNV:
builder.addCapability(spv::CapabilityMeshShadingNV);
builder.addExtension(spv::E_SPV_NV_mesh_shader);
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
std::vector<spv::Id> dimConstId;
for (int dim = 0; dim < 3; ++dim) {
bool specConst = (glslangIntermediate->getLocalSizeSpecId(dim) != glslang::TQualifier::layoutNotSet);
dimConstId.push_back(builder.makeUintConstant(glslangIntermediate->getLocalSize(dim), specConst));
if (specConst) {
builder.addDecoration(dimConstId.back(), spv::DecorationSpecId,
glslangIntermediate->getLocalSizeSpecId(dim));
}
}
builder.addExecutionModeId(shaderEntry, spv::ExecutionModeLocalSizeId, dimConstId);
} else {
builder.addExecutionMode(shaderEntry, spv::ExecutionModeLocalSize, glslangIntermediate->getLocalSize(0),
glslangIntermediate->getLocalSize(1),
glslangIntermediate->getLocalSize(2));
}
if (glslangIntermediate->getStage() == EShLangMeshNV) {
builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices,
glslangIntermediate->getVertices());
@ -3779,7 +3805,16 @@ bool TGlslangToSpvTraverser::visitBranch(glslang::TVisit /* visit */, glslang::T
switch (node->getFlowOp()) {
case glslang::EOpKill:
builder.makeStatementTerminator(spv::OpKill, "post-discard");
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
if (glslangIntermediate->getSource() == glslang::EShSourceHlsl) {
builder.addCapability(spv::CapabilityDemoteToHelperInvocation);
builder.createNoResultOp(spv::OpDemoteToHelperInvocationEXT);
} else {
builder.makeStatementTerminator(spv::OpTerminateInvocation, "post-terminate-invocation");
}
} else {
builder.makeStatementTerminator(spv::OpKill, "post-discard");
}
break;
case glslang::EOpTerminateInvocation:
builder.addExtension(spv::E_SPV_KHR_terminate_invocation);
@ -8761,7 +8796,16 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
// add built-in variable decoration
if (builtIn != spv::BuiltInMax) {
builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn);
// WorkgroupSize deprecated in spirv1.6
if (glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_6 ||
builtIn != spv::BuiltInWorkgroupSize)
builder.addDecoration(id, spv::DecorationBuiltIn, (int)builtIn);
}
// Add volatile decoration to HelperInvocation for spirv1.6 and beyond
if (builtIn == spv::BuiltInHelperInvocation &&
glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_6) {
builder.addDecoration(id, spv::DecorationVolatile);
}
#ifndef GLSLANG_WEB

View File

@ -68,6 +68,26 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
}
case glslang::EShTargetVulkan_1_2:
return spv_target_env::SPV_ENV_VULKAN_1_2;
case glslang::EShTargetUniversal:
switch (spvVersion.spv) {
case EShTargetSpv_1_0:
return spv_target_env::SPV_ENV_UNIVERSAL_1_0;
case EShTargetSpv_1_1:
return spv_target_env::SPV_ENV_UNIVERSAL_1_1;
case EShTargetSpv_1_2:
return spv_target_env::SPV_ENV_UNIVERSAL_1_2;
case EShTargetSpv_1_3:
return spv_target_env::SPV_ENV_UNIVERSAL_1_3;
case EShTargetSpv_1_4:
return spv_target_env::SPV_ENV_UNIVERSAL_1_4;
case EShTargetSpv_1_5:
return spv_target_env::SPV_ENV_UNIVERSAL_1_5;
case EShTargetSpv_1_6:
return spv_target_env::SPV_ENV_UNIVERSAL_1_6;
default:
logger->missingFunctionality("Target version for SPIRV-Tools validator");
return spv_target_env::SPV_ENV_UNIVERSAL_1_6;
}
default:
break;
}

View File

@ -49,12 +49,12 @@ namespace spv {
typedef unsigned int Id;
#define SPV_VERSION 0x10600
#define SPV_REVISION 1
#define SPV_VERSION 0x10500
#define SPV_REVISION 4
static const unsigned int MagicNumber = 0x07230203;
static const unsigned int Version = 0x00010600;
static const unsigned int Revision = 1;
static const unsigned int Version = 0x00010500;
static const unsigned int Revision = 4;
static const unsigned int OpCodeMask = 0xffff;
static const unsigned int WordCountShift = 16;
@ -65,7 +65,6 @@ enum SourceLanguage {
SourceLanguageOpenCL_C = 3,
SourceLanguageOpenCL_CPP = 4,
SourceLanguageHLSL = 5,
SourceLanguageCPP_for_OpenCL = 6,
SourceLanguageMax = 0x7fffffff,
};
@ -353,8 +352,6 @@ enum ImageOperandsShift {
ImageOperandsVolatileTexelKHRShift = 11,
ImageOperandsSignExtendShift = 12,
ImageOperandsZeroExtendShift = 13,
ImageOperandsNontemporalShift = 14,
ImageOperandsOffsetsShift = 16,
ImageOperandsMax = 0x7fffffff,
};
@ -378,8 +375,6 @@ enum ImageOperandsMask {
ImageOperandsVolatileTexelKHRMask = 0x00000800,
ImageOperandsSignExtendMask = 0x00001000,
ImageOperandsZeroExtendMask = 0x00002000,
ImageOperandsNontemporalMask = 0x00004000,
ImageOperandsOffsetsMask = 0x00010000,
};
enum FPFastMathModeShift {
@ -496,7 +491,6 @@ enum Decoration {
DecorationPerPrimitiveNV = 5271,
DecorationPerViewNV = 5272,
DecorationPerTaskNV = 5273,
DecorationPerVertexKHR = 5285,
DecorationPerVertexNV = 5285,
DecorationNonUniform = 5300,
DecorationNonUniformEXT = 5300,
@ -504,10 +498,6 @@ enum Decoration {
DecorationRestrictPointerEXT = 5355,
DecorationAliasedPointer = 5356,
DecorationAliasedPointerEXT = 5356,
DecorationBindlessSamplerNV = 5398,
DecorationBindlessImageNV = 5399,
DecorationBoundSamplerNV = 5400,
DecorationBoundImageNV = 5401,
DecorationSIMTCallINTEL = 5599,
DecorationReferencedIndirectlyINTEL = 5602,
DecorationClobberINTEL = 5607,
@ -547,7 +537,6 @@ enum Decoration {
DecorationFunctionFloatingPointModeINTEL = 6080,
DecorationSingleElementVectorINTEL = 6085,
DecorationVectorComputeCallableFunctionINTEL = 6087,
DecorationMediaBlockIOINTEL = 6140,
DecorationMax = 0x7fffffff,
};
@ -632,9 +621,7 @@ enum BuiltIn {
BuiltInLayerPerViewNV = 5279,
BuiltInMeshViewCountNV = 5280,
BuiltInMeshViewIndicesNV = 5281,
BuiltInBaryCoordKHR = 5286,
BuiltInBaryCoordNV = 5286,
BuiltInBaryCoordNoPerspKHR = 5287,
BuiltInBaryCoordNoPerspNV = 5287,
BuiltInFragSizeEXT = 5292,
BuiltInFragmentSizeNV = 5292,
@ -735,7 +722,6 @@ enum FunctionControlShift {
FunctionControlDontInlineShift = 1,
FunctionControlPureShift = 2,
FunctionControlConstShift = 3,
FunctionControlOptNoneINTELShift = 16,
FunctionControlMax = 0x7fffffff,
};
@ -745,7 +731,6 @@ enum FunctionControlMask {
FunctionControlDontInlineMask = 0x00000002,
FunctionControlPureMask = 0x00000004,
FunctionControlConstMask = 0x00000008,
FunctionControlOptNoneINTELMask = 0x00010000,
};
enum MemorySemanticsShift {
@ -926,7 +911,6 @@ enum Capability {
CapabilityGroupNonUniformQuad = 68,
CapabilityShaderLayer = 69,
CapabilityShaderViewportIndex = 70,
CapabilityUniformDecoration = 71,
CapabilityFragmentShadingRateKHR = 4422,
CapabilitySubgroupBallotKHR = 4423,
CapabilityDrawParameters = 4427,
@ -975,7 +959,6 @@ enum Capability {
CapabilityFragmentFullyCoveredEXT = 5265,
CapabilityMeshShadingNV = 5266,
CapabilityImageFootprintNV = 5282,
CapabilityFragmentBarycentricKHR = 5284,
CapabilityFragmentBarycentricNV = 5284,
CapabilityComputeDerivativeGroupQuadsNV = 5288,
CapabilityFragmentDensityEXT = 5291,
@ -1022,7 +1005,6 @@ enum Capability {
CapabilityFragmentShaderPixelInterlockEXT = 5378,
CapabilityDemoteToHelperInvocation = 5379,
CapabilityDemoteToHelperInvocationEXT = 5379,
CapabilityBindlessTextureNV = 5390,
CapabilitySubgroupShuffleINTEL = 5568,
CapabilitySubgroupBufferBlockIOINTEL = 5569,
CapabilitySubgroupImageBlockIOINTEL = 5570,
@ -1047,7 +1029,6 @@ enum Capability {
CapabilityFPGAMemoryAttributesINTEL = 5824,
CapabilityFPFastMathModeINTEL = 5837,
CapabilityArbitraryPrecisionIntegersINTEL = 5844,
CapabilityArbitraryPrecisionFloatingPointINTEL = 5845,
CapabilityUnstructuredLoopControlsINTEL = 5886,
CapabilityFPGALoopControlsINTEL = 5888,
CapabilityKernelAttributesINTEL = 5892,
@ -1056,26 +1037,14 @@ enum Capability {
CapabilityFPGAClusterAttributesINTEL = 5904,
CapabilityLoopFuseINTEL = 5906,
CapabilityFPGABufferLocationINTEL = 5920,
CapabilityArbitraryPrecisionFixedPointINTEL = 5922,
CapabilityUSMStorageClassesINTEL = 5935,
CapabilityIOPipesINTEL = 5943,
CapabilityBlockingPipesINTEL = 5945,
CapabilityFPGARegINTEL = 5948,
CapabilityDotProductInputAll = 6016,
CapabilityDotProductInputAllKHR = 6016,
CapabilityDotProductInput4x8Bit = 6017,
CapabilityDotProductInput4x8BitKHR = 6017,
CapabilityDotProductInput4x8BitPacked = 6018,
CapabilityDotProductInput4x8BitPackedKHR = 6018,
CapabilityDotProduct = 6019,
CapabilityDotProductKHR = 6019,
CapabilityBitInstructions = 6025,
CapabilityAtomicFloat32AddEXT = 6033,
CapabilityAtomicFloat64AddEXT = 6034,
CapabilityLongConstantCompositeINTEL = 6089,
CapabilityOptNoneINTEL = 6094,
CapabilityAtomicFloat16AddEXT = 6095,
CapabilityDebugInfoModuleINTEL = 6114,
CapabilityMax = 0x7fffffff,
};
@ -1154,32 +1123,6 @@ enum FPOperationMode {
FPOperationModeMax = 0x7fffffff,
};
enum QuantizationModes {
QuantizationModesTRN = 0,
QuantizationModesTRN_ZERO = 1,
QuantizationModesRND = 2,
QuantizationModesRND_ZERO = 3,
QuantizationModesRND_INF = 4,
QuantizationModesRND_MIN_INF = 5,
QuantizationModesRND_CONV = 6,
QuantizationModesRND_CONV_ODD = 7,
QuantizationModesMax = 0x7fffffff,
};
enum OverflowModes {
OverflowModesWRAP = 0,
OverflowModesSAT = 1,
OverflowModesSAT_ZERO = 2,
OverflowModesSAT_SYM = 3,
OverflowModesMax = 0x7fffffff,
};
enum PackedVectorFormat {
PackedVectorFormatPackedVectorFormat4x8Bit = 0,
PackedVectorFormatPackedVectorFormat4x8BitKHR = 0,
PackedVectorFormatMax = 0x7fffffff,
};
enum Op {
OpNop = 0,
OpUndef = 1,
@ -1537,18 +1480,6 @@ enum Op {
OpConvertUToAccelerationStructureKHR = 4447,
OpIgnoreIntersectionKHR = 4448,
OpTerminateRayKHR = 4449,
OpSDot = 4450,
OpSDotKHR = 4450,
OpUDot = 4451,
OpUDotKHR = 4451,
OpSUDot = 4452,
OpSUDotKHR = 4452,
OpSDotAccSat = 4453,
OpSDotAccSatKHR = 4453,
OpUDotAccSat = 4454,
OpUDotAccSatKHR = 4454,
OpSUDotAccSat = 4455,
OpSUDotAccSatKHR = 4455,
OpTypeRayQueryKHR = 4472,
OpRayQueryInitializeKHR = 4473,
OpRayQueryTerminateKHR = 4474,
@ -1587,16 +1518,8 @@ enum Op {
OpCooperativeMatrixLengthNV = 5362,
OpBeginInvocationInterlockEXT = 5364,
OpEndInvocationInterlockEXT = 5365,
OpDemoteToHelperInvocation = 5380,
OpDemoteToHelperInvocationEXT = 5380,
OpIsHelperInvocationEXT = 5381,
OpConvertUToImageNV = 5391,
OpConvertUToSamplerNV = 5392,
OpConvertImageToUNV = 5393,
OpConvertSamplerToUNV = 5394,
OpConvertUToSampledImageNV = 5395,
OpConvertSampledImageToUNV = 5396,
OpSamplerImageAddressingModeNV = 5397,
OpSubgroupShuffleINTEL = 5571,
OpSubgroupShuffleDownINTEL = 5572,
OpSubgroupShuffleUpINTEL = 5573,
@ -1621,7 +1544,7 @@ enum Op {
OpUSubSatINTEL = 5596,
OpIMul32x16INTEL = 5597,
OpUMul32x16INTEL = 5598,
OpConstantFunctionPointerINTEL = 5600,
OpConstFunctionPointerINTEL = 5600,
OpFunctionPointerCallINTEL = 5601,
OpAsmTargetINTEL = 5609,
OpAsmINTEL = 5610,
@ -1755,59 +1678,7 @@ enum Op {
OpVariableLengthArrayINTEL = 5818,
OpSaveMemoryINTEL = 5819,
OpRestoreMemoryINTEL = 5820,
OpArbitraryFloatSinCosPiINTEL = 5840,
OpArbitraryFloatCastINTEL = 5841,
OpArbitraryFloatCastFromIntINTEL = 5842,
OpArbitraryFloatCastToIntINTEL = 5843,
OpArbitraryFloatAddINTEL = 5846,
OpArbitraryFloatSubINTEL = 5847,
OpArbitraryFloatMulINTEL = 5848,
OpArbitraryFloatDivINTEL = 5849,
OpArbitraryFloatGTINTEL = 5850,
OpArbitraryFloatGEINTEL = 5851,
OpArbitraryFloatLTINTEL = 5852,
OpArbitraryFloatLEINTEL = 5853,
OpArbitraryFloatEQINTEL = 5854,
OpArbitraryFloatRecipINTEL = 5855,
OpArbitraryFloatRSqrtINTEL = 5856,
OpArbitraryFloatCbrtINTEL = 5857,
OpArbitraryFloatHypotINTEL = 5858,
OpArbitraryFloatSqrtINTEL = 5859,
OpArbitraryFloatLogINTEL = 5860,
OpArbitraryFloatLog2INTEL = 5861,
OpArbitraryFloatLog10INTEL = 5862,
OpArbitraryFloatLog1pINTEL = 5863,
OpArbitraryFloatExpINTEL = 5864,
OpArbitraryFloatExp2INTEL = 5865,
OpArbitraryFloatExp10INTEL = 5866,
OpArbitraryFloatExpm1INTEL = 5867,
OpArbitraryFloatSinINTEL = 5868,
OpArbitraryFloatCosINTEL = 5869,
OpArbitraryFloatSinCosINTEL = 5870,
OpArbitraryFloatSinPiINTEL = 5871,
OpArbitraryFloatCosPiINTEL = 5872,
OpArbitraryFloatASinINTEL = 5873,
OpArbitraryFloatASinPiINTEL = 5874,
OpArbitraryFloatACosINTEL = 5875,
OpArbitraryFloatACosPiINTEL = 5876,
OpArbitraryFloatATanINTEL = 5877,
OpArbitraryFloatATanPiINTEL = 5878,
OpArbitraryFloatATan2INTEL = 5879,
OpArbitraryFloatPowINTEL = 5880,
OpArbitraryFloatPowRINTEL = 5881,
OpArbitraryFloatPowNINTEL = 5882,
OpLoopControlINTEL = 5887,
OpFixedSqrtINTEL = 5923,
OpFixedRecipINTEL = 5924,
OpFixedRsqrtINTEL = 5925,
OpFixedSinINTEL = 5926,
OpFixedCosINTEL = 5927,
OpFixedSinCosINTEL = 5928,
OpFixedSinPiINTEL = 5929,
OpFixedCosPiINTEL = 5930,
OpFixedSinCosPiINTEL = 5931,
OpFixedLogINTEL = 5932,
OpFixedExpINTEL = 5933,
OpPtrCastToCrossWorkgroupINTEL = 5934,
OpCrossWorkgroupCastToPtrINTEL = 5938,
OpReadPipeBlockingINTEL = 5946,
@ -2199,12 +2070,6 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpConvertUToAccelerationStructureKHR: *hasResult = true; *hasResultType = true; break;
case OpIgnoreIntersectionKHR: *hasResult = false; *hasResultType = false; break;
case OpTerminateRayKHR: *hasResult = false; *hasResultType = false; break;
case OpSDot: *hasResult = true; *hasResultType = true; break;
case OpUDot: *hasResult = true; *hasResultType = true; break;
case OpSUDot: *hasResult = true; *hasResultType = true; break;
case OpSDotAccSat: *hasResult = true; *hasResultType = true; break;
case OpUDotAccSat: *hasResult = true; *hasResultType = true; break;
case OpSUDotAccSat: *hasResult = true; *hasResultType = true; break;
case OpTypeRayQueryKHR: *hasResult = true; *hasResultType = false; break;
case OpRayQueryInitializeKHR: *hasResult = false; *hasResultType = false; break;
case OpRayQueryTerminateKHR: *hasResult = false; *hasResultType = false; break;
@ -2241,15 +2106,8 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpCooperativeMatrixLengthNV: *hasResult = true; *hasResultType = true; break;
case OpBeginInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break;
case OpEndInvocationInterlockEXT: *hasResult = false; *hasResultType = false; break;
case OpDemoteToHelperInvocation: *hasResult = false; *hasResultType = false; break;
case OpDemoteToHelperInvocationEXT: *hasResult = false; *hasResultType = false; break;
case OpIsHelperInvocationEXT: *hasResult = true; *hasResultType = true; break;
case OpConvertUToImageNV: *hasResult = true; *hasResultType = true; break;
case OpConvertUToSamplerNV: *hasResult = true; *hasResultType = true; break;
case OpConvertImageToUNV: *hasResult = true; *hasResultType = true; break;
case OpConvertSamplerToUNV: *hasResult = true; *hasResultType = true; break;
case OpConvertUToSampledImageNV: *hasResult = true; *hasResultType = true; break;
case OpConvertSampledImageToUNV: *hasResult = true; *hasResultType = true; break;
case OpSamplerImageAddressingModeNV: *hasResult = false; *hasResultType = false; break;
case OpSubgroupShuffleINTEL: *hasResult = true; *hasResultType = true; break;
case OpSubgroupShuffleDownINTEL: *hasResult = true; *hasResultType = true; break;
case OpSubgroupShuffleUpINTEL: *hasResult = true; *hasResultType = true; break;
@ -2274,7 +2132,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpUSubSatINTEL: *hasResult = true; *hasResultType = true; break;
case OpIMul32x16INTEL: *hasResult = true; *hasResultType = true; break;
case OpUMul32x16INTEL: *hasResult = true; *hasResultType = true; break;
case OpConstantFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break;
case OpConstFunctionPointerINTEL: *hasResult = true; *hasResultType = true; break;
case OpFunctionPointerCallINTEL: *hasResult = true; *hasResultType = true; break;
case OpAsmTargetINTEL: *hasResult = true; *hasResultType = true; break;
case OpAsmINTEL: *hasResult = true; *hasResultType = true; break;
@ -2406,59 +2264,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
case OpVariableLengthArrayINTEL: *hasResult = true; *hasResultType = true; break;
case OpSaveMemoryINTEL: *hasResult = true; *hasResultType = true; break;
case OpRestoreMemoryINTEL: *hasResult = false; *hasResultType = false; break;
case OpArbitraryFloatSinCosPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatCastINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatCastFromIntINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatCastToIntINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatAddINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatSubINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatMulINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatDivINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatGTINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatGEINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatLTINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatLEINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatEQINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatRecipINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatRSqrtINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatCbrtINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatHypotINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatSqrtINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatLogINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatLog2INTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatLog10INTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatLog1pINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatExpINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatExp2INTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatExp10INTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatExpm1INTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatSinINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatCosINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatSinCosINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatSinPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatCosPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatASinINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatASinPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatACosINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatACosPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatATanINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatATanPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatATan2INTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatPowINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatPowRINTEL: *hasResult = true; *hasResultType = true; break;
case OpArbitraryFloatPowNINTEL: *hasResult = true; *hasResultType = true; break;
case OpLoopControlINTEL: *hasResult = false; *hasResultType = false; break;
case OpFixedSqrtINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedRecipINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedRsqrtINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedSinINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedCosINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedSinCosINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedSinPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedCosPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedSinCosPiINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedLogINTEL: *hasResult = true; *hasResultType = true; break;
case OpFixedExpINTEL: *hasResult = true; *hasResultType = true; break;
case OpPtrCastToCrossWorkgroupINTEL: *hasResult = true; *hasResultType = true; break;
case OpCrossWorkgroupCastToPtrINTEL: *hasResult = true; *hasResultType = true; break;
case OpReadPipeBlockingINTEL: *hasResult = true; *hasResultType = true; break;
@ -2506,4 +2312,3 @@ inline FragmentShadingRateMask operator|(FragmentShadingRateMask a, FragmentShad
} // end namespace spv
#endif // #ifndef spirv_HPP

View File

@ -788,9 +788,13 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
} else if (strcmp(argv[1], "spirv1.5") == 0) {
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_5;
} else if (strcmp(argv[1], "spirv1.6") == 0) {
TargetLanguage = glslang::EShTargetSpv;
TargetVersion = glslang::EShTargetSpv_1_6;
} else
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2, opengl,\n"
"spirv1.0, spirv1.1, spirv1.2, spirv1.3, spirv1.4, or spirv1.5");
Error("--target-env expected one of: vulkan1.0, vulkan1.1, vulkan1.2,\n"
"opengl, spirv1.0, spirv1.1, spirv1.2, spirv1.3,\n"
"spirv1.4, spirv1.5 or spirv1.6");
}
bumpArg();
} else if (lowerword == "undef-macro" ||
@ -1930,8 +1934,9 @@ void usage()
" --sep synonym for --source-entrypoint\n"
" --stdin read from stdin instead of from a file;\n"
" requires providing the shader stage using -S\n"
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | opengl | \n"
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 | spirv1.5}\n"
" --target-env {vulkan1.0 | vulkan1.1 | vulkan1.2 | opengl |\n"
" spirv1.0 | spirv1.1 | spirv1.2 | spirv1.3 | spirv1.4 |\n"
" spirv1.5 | spirv1.6}\n"
" Set the execution environment that the\n"
" generated code will be executed in.\n"
" Defaults to:\n"

View File

@ -0,0 +1,193 @@
hlsl.spv.1.6.discard.frag
Shader version: 500
0:? Sequence
0:2 Function Definition: foo(f1; ( temp void)
0:2 Function Parameters:
0:2 'f' ( in float)
0:? Sequence
0:3 Test condition and select ( temp void)
0:3 Condition
0:3 Compare Less Than ( temp bool)
0:3 'f' ( in float)
0:3 Constant:
0:3 1.000000
0:3 true case
0:4 Branch: Kill
0:8 Function Definition: @PixelShaderFunction(vf4; ( temp void)
0:8 Function Parameters:
0:8 'input' ( in 4-component vector of float)
0:? Sequence
0:9 Function Call: foo(f1; ( temp void)
0:9 direct index ( temp float)
0:9 'input' ( in 4-component vector of float)
0:9 Constant:
0:9 2 (const int)
0:10 Test condition and select ( temp void)
0:10 Condition
0:10 Convert float to bool ( temp bool)
0:10 direct index ( temp float)
0:10 'input' ( in 4-component vector of float)
0:10 Constant:
0:10 0 (const int)
0:10 true case
0:11 Branch: Kill
0:12 Sequence
0:12 move second child to first child ( temp float)
0:12 'f' ( temp float)
0:12 direct index ( temp float)
0:12 'input' ( in 4-component vector of float)
0:12 Constant:
0:12 0 (const int)
0:13 Branch: Kill
0:8 Function Definition: PixelShaderFunction( ( temp void)
0:8 Function Parameters:
0:? Sequence
0:8 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float)
0:8 Function Call: @PixelShaderFunction(vf4; ( temp void)
0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'input' (layout( location=0) in 4-component vector of float)
Linked fragment stage:
Shader version: 500
0:? Sequence
0:2 Function Definition: foo(f1; ( temp void)
0:2 Function Parameters:
0:2 'f' ( in float)
0:? Sequence
0:3 Test condition and select ( temp void)
0:3 Condition
0:3 Compare Less Than ( temp bool)
0:3 'f' ( in float)
0:3 Constant:
0:3 1.000000
0:3 true case
0:4 Branch: Kill
0:8 Function Definition: @PixelShaderFunction(vf4; ( temp void)
0:8 Function Parameters:
0:8 'input' ( in 4-component vector of float)
0:? Sequence
0:9 Function Call: foo(f1; ( temp void)
0:9 direct index ( temp float)
0:9 'input' ( in 4-component vector of float)
0:9 Constant:
0:9 2 (const int)
0:10 Test condition and select ( temp void)
0:10 Condition
0:10 Convert float to bool ( temp bool)
0:10 direct index ( temp float)
0:10 'input' ( in 4-component vector of float)
0:10 Constant:
0:10 0 (const int)
0:10 true case
0:11 Branch: Kill
0:12 Sequence
0:12 move second child to first child ( temp float)
0:12 'f' ( temp float)
0:12 direct index ( temp float)
0:12 'input' ( in 4-component vector of float)
0:12 Constant:
0:12 0 (const int)
0:13 Branch: Kill
0:8 Function Definition: PixelShaderFunction( ( temp void)
0:8 Function Parameters:
0:? Sequence
0:8 move second child to first child ( temp 4-component vector of float)
0:? 'input' ( temp 4-component vector of float)
0:? 'input' (layout( location=0) in 4-component vector of float)
0:8 Function Call: @PixelShaderFunction(vf4; ( temp void)
0:? 'input' ( temp 4-component vector of float)
0:? Linker Objects
0:? 'input' (layout( location=0) in 4-component vector of float)
// Module Version 10600
// Generated by (magic number): 8000a
// Id's are bound by 47
Capability Shader
Capability DemoteToHelperInvocationEXT
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "PixelShaderFunction" 42
ExecutionMode 4 OriginLowerLeft
Source HLSL 500
Name 4 "PixelShaderFunction"
Name 10 "foo(f1;"
Name 9 "f"
Name 16 "@PixelShaderFunction(vf4;"
Name 15 "input"
Name 24 "param"
Name 37 "f"
Name 40 "input"
Name 42 "input"
Name 44 "param"
Decorate 42(input) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Function 6(float)
8: TypeFunction 2 7(ptr)
12: TypeVector 6(float) 4
13: TypePointer Function 12(fvec4)
14: TypeFunction 2 13(ptr)
19: 6(float) Constant 1065353216
20: TypeBool
25: TypeInt 32 0
26: 25(int) Constant 2
30: 25(int) Constant 0
33: 6(float) Constant 0
41: TypePointer Input 12(fvec4)
42(input): 41(ptr) Variable Input
4(PixelShaderFunction): 2 Function None 3
5: Label
40(input): 13(ptr) Variable Function
44(param): 13(ptr) Variable Function
43: 12(fvec4) Load 42(input)
Store 40(input) 43
45: 12(fvec4) Load 40(input)
Store 44(param) 45
46: 2 FunctionCall 16(@PixelShaderFunction(vf4;) 44(param)
Return
FunctionEnd
10(foo(f1;): 2 Function None 8
9(f): 7(ptr) FunctionParameter
11: Label
18: 6(float) Load 9(f)
21: 20(bool) FOrdLessThan 18 19
SelectionMerge 23 None
BranchConditional 21 22 23
22: Label
DemoteToHelperInvocationEXT
Branch 23
23: Label
Return
FunctionEnd
16(@PixelShaderFunction(vf4;): 2 Function None 14
15(input): 13(ptr) FunctionParameter
17: Label
24(param): 7(ptr) Variable Function
37(f): 7(ptr) Variable Function
27: 7(ptr) AccessChain 15(input) 26
28: 6(float) Load 27
Store 24(param) 28
29: 2 FunctionCall 10(foo(f1;) 24(param)
31: 7(ptr) AccessChain 15(input) 30
32: 6(float) Load 31
34: 20(bool) FUnordNotEqual 32 33
SelectionMerge 36 None
BranchConditional 34 35 36
35: Label
DemoteToHelperInvocationEXT
Branch 36
36: Label
38: 7(ptr) AccessChain 15(input) 30
39: 6(float) Load 38
Store 37(f) 39
DemoteToHelperInvocationEXT
Return
FunctionEnd

View File

@ -0,0 +1,59 @@
spv.1.6.conditionalDiscard.frag
// Module Version 10600
// Generated by (magic number): 8000a
// Id's are bound by 36
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 13 17 34
ExecutionMode 4 OriginLowerLeft
Source GLSL 400
Name 4 "main"
Name 9 "v"
Name 13 "tex"
Name 17 "coord"
Name 34 "gl_FragColor"
Decorate 13(tex) DescriptorSet 0
Decorate 13(tex) Binding 0
Decorate 17(coord) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: TypeImage 6(float) 2D sampled format:Unknown
11: TypeSampledImage 10
12: TypePointer UniformConstant 11
13(tex): 12(ptr) Variable UniformConstant
15: TypeVector 6(float) 2
16: TypePointer Input 15(fvec2)
17(coord): 16(ptr) Variable Input
21: 6(float) Constant 1036831949
22: 6(float) Constant 1045220557
23: 6(float) Constant 1050253722
24: 6(float) Constant 1053609165
25: 7(fvec4) ConstantComposite 21 22 23 24
26: TypeBool
27: TypeVector 26(bool) 4
33: TypePointer Output 7(fvec4)
34(gl_FragColor): 33(ptr) Variable Output
4(main): 2 Function None 3
5: Label
9(v): 8(ptr) Variable Function
14: 11 Load 13(tex)
18: 15(fvec2) Load 17(coord)
19: 7(fvec4) ImageSampleImplicitLod 14 18
Store 9(v) 19
20: 7(fvec4) Load 9(v)
28: 27(bvec4) FOrdEqual 20 25
29: 26(bool) All 28
SelectionMerge 31 None
BranchConditional 29 30 31
30: Label
TerminateInvocation
31: Label
35: 7(fvec4) Load 9(v)
Store 34(gl_FragColor) 35
Return
FunctionEnd

View File

@ -0,0 +1,41 @@
spv.1.6.helperInvocation.frag
// Module Version 10600
// Generated by (magic number): 8000a
// Id's are bound by 20
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8 15
ExecutionMode 4 OriginLowerLeft
Source ESSL 310
Name 4 "main"
Name 8 "gl_HelperInvocation"
Name 15 "outp"
Decorate 8(gl_HelperInvocation) BuiltIn HelperInvocation
Decorate 8(gl_HelperInvocation) Volatile
Decorate 15(outp) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeBool
7: TypePointer Input 6(bool)
8(gl_HelperInvocation): 7(ptr) Variable Input
12: TypeFloat 32
13: TypeVector 12(float) 4
14: TypePointer Output 13(fvec4)
15(outp): 14(ptr) Variable Output
17: 12(float) Constant 1065353216
4(main): 2 Function None 3
5: Label
9: 6(bool) Load 8(gl_HelperInvocation)
SelectionMerge 11 None
BranchConditional 9 10 11
10: Label
16: 13(fvec4) Load 15(outp)
18: 13(fvec4) CompositeConstruct 17 17 17 17
19: 13(fvec4) FAdd 16 18
Store 15(outp) 19
Branch 11
11: Label
Return
FunctionEnd

View File

@ -0,0 +1,69 @@
spv.1.6.specConstant.comp
// Module Version 10600
// Generated by (magic number): 8000a
// Id's are bound by 39
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main" 18
ExecutionModeId 4 LocalSizeId 7 8 9
Source GLSL 450
Name 4 "main"
Name 14 "foo(vu3;"
Name 13 "wgs"
Name 16 "bn"
MemberName 16(bn) 0 "a"
Name 18 "bi"
Name 37 "param"
Decorate 7 SpecId 18
Decorate 9 SpecId 19
MemberDecorate 16(bn) 0 Offset 0
Decorate 16(bn) Block
Decorate 18(bi) DescriptorSet 0
Decorate 18(bi) Binding 0
Decorate 25 SpecId 18
Decorate 26 SpecId 19
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: 6(int) SpecConstant 32
8: 6(int) Constant 32
9: 6(int) SpecConstant 1
10: TypeVector 6(int) 3
11: TypePointer Function 10(ivec3)
12: TypeFunction 2 11(ptr)
16(bn): TypeStruct 6(int)
17: TypePointer StorageBuffer 16(bn)
18(bi): 17(ptr) Variable StorageBuffer
19: TypeInt 32 1
20: 19(int) Constant 0
21: 6(int) Constant 0
22: TypePointer Function 6(int)
25: 6(int) SpecConstant 32
26: 6(int) SpecConstant 1
27: 10(ivec3) SpecConstantComposite 25 8 26
28: 6(int) Constant 1
31: 6(int) Constant 2
35: TypePointer StorageBuffer 6(int)
4(main): 2 Function None 3
5: Label
37(param): 11(ptr) Variable Function
Store 37(param) 27
38: 2 FunctionCall 14(foo(vu3;) 37(param)
Return
FunctionEnd
14(foo(vu3;): 2 Function None 12
13(wgs): 11(ptr) FunctionParameter
15: Label
23: 22(ptr) AccessChain 13(wgs) 21
24: 6(int) Load 23
29: 6(int) CompositeExtract 27 1
30: 6(int) IMul 24 29
32: 22(ptr) AccessChain 13(wgs) 31
33: 6(int) Load 32
34: 6(int) IMul 30 33
36: 35(ptr) AccessChain 18(bi) 20
Store 36 34
Return
FunctionEnd

View File

@ -0,0 +1,14 @@
void foo(float f)
{
if (f < 1.0)
discard;
}
void PixelShaderFunction(float4 input) : COLOR0
{
foo(input.z);
if (input.x)
discard;
float f = input.x;
discard;
}

View File

@ -0,0 +1,14 @@
#version 400
uniform sampler2D tex;
in vec2 coord;
void main (void)
{
vec4 v = texture(tex, coord);
if (v == vec4(0.1,0.2,0.3,0.4))
discard;
gl_FragColor = v;
}

View File

@ -0,0 +1,10 @@
#version 310 es
precision highp float;
out vec4 outp;
void main()
{
if (gl_HelperInvocation)
++outp;
}

View File

@ -0,0 +1,18 @@
#version 450
layout(local_size_x_id = 18, local_size_z_id = 19) in;
layout(local_size_x = 32, local_size_y = 32) in;
buffer bn {
uint a;
} bi;
void foo(uvec3 wgs)
{
bi.a = wgs.x * gl_WorkGroupSize.y * wgs.z;
}
void main()
{
foo(gl_WorkGroupSize);
}

View File

@ -244,6 +244,8 @@ c_shader_target_language_version(glslang_target_language_version_t target_langua
return glslang::EShTargetSpv_1_4;
case GLSLANG_TARGET_SPV_1_5:
return glslang::EShTargetSpv_1_5;
case GLSLANG_TARGET_SPV_1_6:
return glslang::EShTargetSpv_1_6;
default:
break;
}

View File

@ -113,7 +113,8 @@ typedef enum {
GLSLANG_TARGET_SPV_1_3 = (1 << 16) | (3 << 8),
GLSLANG_TARGET_SPV_1_4 = (1 << 16) | (4 << 8),
GLSLANG_TARGET_SPV_1_5 = (1 << 16) | (5 << 8),
LAST_ELEMENT_MARKER(GLSLANG_TARGET_LANGUAGE_VERSION_COUNT = 6),
GLSLANG_TARGET_SPV_1_6 = (1 << 16) | (6 << 8),
LAST_ELEMENT_MARKER(GLSLANG_TARGET_LANGUAGE_VERSION_COUNT = 7),
} glslang_target_language_version_t;
/* EShExecutable counterpart */

View File

@ -398,6 +398,9 @@ public:
case EShTargetSpv_1_5:
processes.addProcess("target-env spirv1.5");
break;
case EShTargetSpv_1_6:
processes.addProcess("target-env spirv1.6");
break;
default:
processes.addProcess("target-env spirvUnknown");
break;

View File

@ -163,6 +163,7 @@ typedef enum {
} EShTargetLanguage;
typedef enum {
EShTargetUniversal = 0, // Universal
EShTargetVulkan_1_0 = (1 << 22), // Vulkan 1.0
EShTargetVulkan_1_1 = (1 << 22) | (1 << 12), // Vulkan 1.1
EShTargetVulkan_1_2 = (1 << 22) | (2 << 12), // Vulkan 1.2
@ -179,7 +180,8 @@ typedef enum {
EShTargetSpv_1_3 = (1 << 16) | (3 << 8), // SPIR-V 1.3
EShTargetSpv_1_4 = (1 << 16) | (4 << 8), // SPIR-V 1.4
EShTargetSpv_1_5 = (1 << 16) | (5 << 8), // SPIR-V 1.5
LAST_ELEMENT_MARKER(EShTargetLanguageVersionCount = 6),
EShTargetSpv_1_6 = (1 << 16) | (6 << 8), // SPIR-V 1.6
LAST_ELEMENT_MARKER(EShTargetLanguageVersionCount = 7),
} EShTargetLanguageVersion;
struct TInputLanguage {

View File

@ -59,6 +59,7 @@ std::string FileNameAsCustomTestSuffix(
using HlslCompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslVulkan1_1CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslSpv1_6CompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
@ -81,6 +82,13 @@ TEST_P(HlslVulkan1_1CompileTest, FromFile)
Target::BothASTAndSpv, true, GetParam().entryPoint);
}
TEST_P(HlslSpv1_6CompileTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan, glslang::EShTargetUniversal, glslang::EShTargetSpv_1_6,
Target::BothASTAndSpv, true, GetParam().entryPoint);
}
TEST_P(HlslCompileAndFlattenTest, FromFile)
{
loadFileCompileFlattenUniformsAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
@ -450,6 +458,16 @@ INSTANTIATE_TEST_SUITE_P(
);
// clang-format on
// clang-format off
INSTANTIATE_TEST_SUITE_P(
ToSpirv, HlslSpv1_6CompileTest,
::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
{"hlsl.spv.1.6.discard.frag", "PixelShaderFunction"}
}),
FileNameAsCustomTestSuffix
);
// clang-format on
// clang-format off
INSTANTIATE_TEST_SUITE_P(
ToSpirv, HlslCompileAndFlattenTest,

View File

@ -69,6 +69,7 @@ using CompileVulkanToSpirvDeadCodeElimTest = GlslangTest<::testing::TestWithPara
using CompileVulkanToDebugSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkan1_1ToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileToSpirv14Test = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileToSpirv16Test = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileOpenGLToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using VulkanSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using OpenGLSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
@ -122,6 +123,13 @@ TEST_P(CompileToSpirv14Test, FromFile)
Target::Spv);
}
TEST_P(CompileToSpirv16Test, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetUniversal, glslang::EShTargetSpv_1_6,
Target::Spv);
}
// Compiling GLSL to SPIR-V under OpenGL semantics. Expected to successfully
// generate SPIR-V.
TEST_P(CompileOpenGLToSpirvTest, FromFile)
@ -621,6 +629,18 @@ INSTANTIATE_TEST_SUITE_P(
FileNameAsCustomTestSuffix
);
// clang-format off
INSTANTIATE_TEST_SUITE_P(
Glsl, CompileToSpirv16Test,
::testing::ValuesIn(std::vector<std::string>({
"spv.1.6.conditionalDiscard.frag",
"spv.1.6.helperInvocation.frag",
"spv.1.6.specConstant.comp",
})),
FileNameAsCustomTestSuffix
);
// clang-format off
INSTANTIATE_TEST_SUITE_P(
Hlsl, HlslIoMap,

View File

@ -5,14 +5,14 @@
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Tools",
"subdir" : "External/spirv-tools",
"commit" : "4b092d2ab81854e61632bdd1e658907f0071c37e"
"commit" : "7d768812e20296c877a44ce0633d71f952fbf83c"
},
{
"name" : "spirv-tools/external/spirv-headers",
"site" : "github",
"subrepo" : "KhronosGroup/SPIRV-Headers",
"subdir" : "External/spirv-tools/external/spirv-headers",
"commit" : "814e728b30ddd0f4509233099a3ad96fd4318c07"
"commit" : "eddd4dfc930f1374a70797460240a501c7d333f7"
}
]
}