Externals: Update glslang to upstream commit 32d3ec3

This commit is contained in:
Stenzek
2018-06-02 07:26:43 +00:00
parent 160d16f1b3
commit bc96557ec4
149 changed files with 47830 additions and 13886 deletions

274
Externals/glslang/gtests/Spv.FromFile.cpp vendored Normal file → Executable file
View File

@ -1,4 +1,4 @@
//
//
// Copyright (C) 2016 Google, Inc.
//
// All rights reserved.
@ -41,18 +41,56 @@
namespace glslangtest {
namespace {
struct IoMapData {
const char* fileName;
const char* entryPoint;
int baseSamplerBinding;
int baseTextureBinding;
int baseImageBinding;
int baseUboBinding;
int baseSsboBinding;
bool autoMapBindings;
bool flattenUniforms;
};
std::string FileNameAsCustomTestSuffixIoMap(
const ::testing::TestParamInfo<IoMapData>& info) {
std::string name = info.param.fileName;
// A valid test case suffix cannot have '.' and '-' inside.
std::replace(name.begin(), name.end(), '.', '_');
std::replace(name.begin(), name.end(), '-', '_');
return name;
}
using CompileVulkanToSpirvTest = GlslangTest<::testing::TestWithParam<std::string>>;
using CompileVulkan1_1ToSpirvTest = 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>>;
using VulkanAstSemantics = GlslangTest<::testing::TestWithParam<std::string>>;
using HlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
using GlslIoMap = GlslangTest<::testing::TestWithParam<IoMapData>>;
#ifdef AMD_EXTENSIONS
using CompileVulkanToSpirvTestAMD = GlslangTest<::testing::TestWithParam<std::string>>;
#endif
#ifdef NV_EXTENSIONS
using CompileVulkanToSpirvTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
#endif
using CompileUpgradeTextureToSampledTextureAndDropSamplersTest = GlslangTest<::testing::TestWithParam<std::string>>;
// Compiling GLSL to SPIR-V under Vulkan semantics. Expected to successfully
// generate SPIR-V.
TEST_P(CompileVulkanToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
Source::GLSL, Semantics::Vulkan,
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Target::Spv);
}
TEST_P(CompileVulkan1_1ToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_1,
Target::Spv);
}
@ -60,8 +98,8 @@ TEST_P(CompileVulkanToSpirvTest, FromFile)
// generate SPIR-V.
TEST_P(CompileOpenGLToSpirvTest, FromFile)
{
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
Source::GLSL, Semantics::OpenGL,
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
Target::Spv);
}
@ -69,28 +107,89 @@ TEST_P(CompileOpenGLToSpirvTest, FromFile)
// SPIR-V.
TEST_P(VulkanSemantics, FromFile)
{
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
Source::GLSL, Semantics::Vulkan,
Target::Spv);
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Target::Spv, false);
}
// GLSL-level Vulkan semantics test. Expected to error out before generating
// SPIR-V.
TEST_P(OpenGLSemantics, FromFile)
{
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
Source::GLSL, Semantics::OpenGL,
Target::Spv);
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0,
Target::Spv, false);
}
// GLSL-level Vulkan semantics test that need to see the AST for validation.
TEST_P(VulkanAstSemantics, FromFile)
{
loadFileCompileAndCheck(GLSLANG_TEST_DIRECTORY, GetParam(),
Source::GLSL, Semantics::Vulkan,
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Target::AST);
}
// HLSL-level Vulkan semantics tests.
TEST_P(HlslIoMap, FromFile)
{
loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::HLSL, Semantics::Vulkan,
Target::Spv, GetParam().entryPoint,
GetParam().baseSamplerBinding,
GetParam().baseTextureBinding,
GetParam().baseImageBinding,
GetParam().baseUboBinding,
GetParam().baseSsboBinding,
GetParam().autoMapBindings,
GetParam().flattenUniforms);
}
// GLSL-level Vulkan semantics tests.
TEST_P(GlslIoMap, FromFile)
{
loadFileCompileIoMapAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
Source::GLSL, Semantics::Vulkan,
Target::Spv, GetParam().entryPoint,
GetParam().baseSamplerBinding,
GetParam().baseTextureBinding,
GetParam().baseImageBinding,
GetParam().baseUboBinding,
GetParam().baseSsboBinding,
GetParam().autoMapBindings,
GetParam().flattenUniforms);
}
#ifdef AMD_EXTENSIONS
// Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled).
// Expected to successfully generate SPIR-V.
TEST_P(CompileVulkanToSpirvTestAMD, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Target::Spv);
}
#endif
#ifdef NV_EXTENSIONS
// Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled).
// Expected to successfully generate SPIR-V.
TEST_P(CompileVulkanToSpirvTestNV, FromFile)
{
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0,
Target::Spv);
}
#endif
TEST_P(CompileUpgradeTextureToSampledTextureAndDropSamplersTest, FromFile)
{
loadCompileUpgradeTextureToSampledTextureAndDropSamplersAndCheck(GlobalTestSettings.testRoot,
GetParam(),
Source::GLSL,
Semantics::Vulkan,
Target::Spv);
}
// clang-format off
INSTANTIATE_TEST_CASE_P(
Glsl, CompileVulkanToSpirvTest,
@ -98,6 +197,7 @@ INSTANTIATE_TEST_CASE_P(
// Test looping constructs.
// No tests yet for making sure break and continue from a nested loop
// goes to the innermost target.
"spv.barrier.vert",
"spv.do-simple.vert",
"spv.do-while-continue-break.vert",
"spv.for-complex-condition.vert",
@ -129,15 +229,22 @@ INSTANTIATE_TEST_CASE_P(
"spv.430.frag",
"spv.430.vert",
"spv.450.tesc",
"spv.450.geom",
"spv.450.noRedecl.tesc",
"spv.accessChain.frag",
"spv.aggOps.frag",
"spv.always-discard.frag",
"spv.always-discard2.frag",
"spv.arbPostDepthCoverage.frag",
"spv.arbPostDepthCoverage_Error.frag",
"spv.bitCast.frag",
"spv.bool.vert",
"spv.boolInBlock.frag",
"spv.branch-return.vert",
"spv.builtInXFB.vert",
"spv.conditionalDiscard.frag",
"spv.constStruct.vert",
"spv.controlFlowAttributes.frag",
"spv.conversion.frag",
"spv.dataOut.frag",
"spv.dataOutIndirect.frag",
@ -147,13 +254,19 @@ INSTANTIATE_TEST_CASE_P(
"spv.discard-dce.frag",
"spv.doWhileLoop.frag",
"spv.earlyReturnDiscard.frag",
"spv.extPostDepthCoverage.frag",
"spv.extPostDepthCoverage_Error.frag",
"spv.flowControl.frag",
"spv.forLoop.frag",
"spv.forwardFun.frag",
"spv.fullyCovered.frag",
"spv.functionCall.frag",
"spv.functionNestedOpaque.vert",
"spv.functionSemantics.frag",
"spv.GeometryShaderPassthrough.geom",
"spv.interpOps.frag",
"spv.int64.frag",
"spv.intOps.vert",
"spv.layoutNested.vert",
"spv.length.frag",
"spv.localAggregates.frag",
@ -164,16 +277,28 @@ INSTANTIATE_TEST_CASE_P(
"spv.matrix2.frag",
"spv.memoryQualifier.frag",
"spv.merge-unreachable.frag",
"spv.multiStruct.comp",
"spv.multiStructFuncall.frag",
"spv.newTexture.frag",
"spv.noDeadDecorations.vert",
"spv.nonSquare.vert",
"spv.nonuniform.frag",
"spv.noWorkgroup.comp",
"spv.offsets.frag",
"spv.Operations.frag",
"spv.intOps.vert",
"spv.paramMemory.frag",
"spv.precision.frag",
"spv.precisionNonESSamp.frag",
"spv.prepost.frag",
"spv.qualifiers.vert",
"spv.sample.frag",
"spv.sampleId.frag",
"spv.samplePosition.frag",
"spv.sampleMaskOverrideCoverage.frag",
"spv.shaderBallot.comp",
"spv.shaderDrawParams.vert",
"spv.shaderGroupVote.comp",
"spv.shaderStencilExport.frag",
"spv.shiftOps.frag",
"spv.simpleFunctionCall.frag",
"spv.simpleMat.vert",
@ -184,10 +309,12 @@ INSTANTIATE_TEST_CASE_P(
"spv.structure.frag",
"spv.switch.frag",
"spv.swizzle.frag",
"spv.swizzleInversion.frag",
"spv.test.frag",
"spv.test.vert",
"spv.texture.frag",
"spv.texture.vert",
"spv.textureBuffer.vert",
"spv.image.frag",
"spv.types.frag",
"spv.uint.frag",
@ -195,6 +322,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.variableArrayIndex.frag",
"spv.varyingArray.frag",
"spv.varyingArrayIndirect.frag",
"spv.vecMatConstruct.frag",
"spv.voidFunction.frag",
"spv.whileLoop.frag",
"spv.AofA.frag",
@ -202,24 +330,99 @@ INSTANTIATE_TEST_CASE_P(
"spv.separate.frag",
"spv.shortCircuit.frag",
"spv.pushConstant.vert",
"spv.pushConstantAnon.vert",
"spv.subpass.frag",
"spv.specConstant.vert",
"spv.specConstant.comp",
"spv.specConstantComposite.vert",
"spv.specConstantOperations.vert",
"spv.storageBuffer.vert",
"spv.precise.tese",
"spv.precise.tesc",
"spv.vulkan100.subgroupArithmetic.comp",
"spv.vulkan100.subgroupPartitioned.comp",
"spv.xfb.vert",
"spv.xfb2.vert",
"spv.xfb3.vert",
})),
FileNameAsCustomTestSuffix
);
// clang-format off
INSTANTIATE_TEST_CASE_P(
Glsl, CompileVulkan1_1ToSpirvTest,
::testing::ValuesIn(std::vector<std::string>({
"spv.deviceGroup.frag",
"spv.drawParams.vert",
"spv.int8.frag",
"spv.vulkan110.int16.frag",
"spv.int32.frag",
"spv.explicittypes.frag",
"spv.float32.frag",
"spv.float64.frag",
"spv.multiView.frag",
"spv.subgroup.frag",
"spv.subgroup.geom",
"spv.subgroup.tesc",
"spv.subgroup.tese",
"spv.subgroup.vert",
"spv.subgroupArithmetic.comp",
"spv.subgroupBasic.comp",
"spv.subgroupBallot.comp",
"spv.subgroupClustered.comp",
"spv.subgroupClusteredNeg.comp",
"spv.subgroupPartitioned.comp",
"spv.subgroupShuffle.comp",
"spv.subgroupShuffleRelative.comp",
"spv.subgroupQuad.comp",
"spv.subgroupVote.comp",
"spv.vulkan110.storageBuffer.vert",
})),
FileNameAsCustomTestSuffix
);
// clang-format off
INSTANTIATE_TEST_CASE_P(
Hlsl, HlslIoMap,
::testing::ValuesIn(std::vector<IoMapData>{
{ "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
{ "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
{ "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
{ "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
{ "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
{ "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
{ "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
{ "spv.rw.autoassign.frag", "main", 5, 10, 20, 15, 30, true, true },
{ "spv.register.autoassign.rangetest.frag", "main",
glslang::TQualifier::layoutBindingEnd-2,
glslang::TQualifier::layoutBindingEnd+5,
20, 30, true, false },
}),
FileNameAsCustomTestSuffixIoMap
);
// clang-format off
INSTANTIATE_TEST_CASE_P(
Hlsl, GlslIoMap,
::testing::ValuesIn(std::vector<IoMapData>{
{ "spv.glsl.register.autoassign.frag", "main", 5, 10, 0, 20, 30, true, false },
{ "spv.glsl.register.noautoassign.frag", "main", 5, 10, 0, 15, 30, false, false },
}),
FileNameAsCustomTestSuffixIoMap
);
// clang-format off
INSTANTIATE_TEST_CASE_P(
Glsl, CompileOpenGLToSpirvTest,
::testing::ValuesIn(std::vector<std::string>({
"spv.460.frag",
"spv.460.vert",
"spv.460.comp",
"spv.atomic.comp",
"spv.glFragColor.frag",
"spv.rankShift.comp",
"spv.specConst.vert",
"spv.OVR_multiview.vert",
})),
FileNameAsCustomTestSuffix
);
@ -253,6 +456,49 @@ INSTANTIATE_TEST_CASE_P(
})),
FileNameAsCustomTestSuffix
);
#ifdef AMD_EXTENSIONS
INSTANTIATE_TEST_CASE_P(
Glsl, CompileVulkanToSpirvTestAMD,
::testing::ValuesIn(std::vector<std::string>({
"spv.float16.frag",
"spv.float16Fetch.frag",
"spv.imageLoadStoreLod.frag",
"spv.int16.frag",
"spv.int16.amd.frag",
"spv.shaderBallotAMD.comp",
"spv.shaderFragMaskAMD.frag",
"spv.textureGatherBiasLod.frag",
})),
FileNameAsCustomTestSuffix
);
#endif
#ifdef NV_EXTENSIONS
INSTANTIATE_TEST_CASE_P(
Glsl, CompileVulkanToSpirvTestNV,
::testing::ValuesIn(std::vector<std::string>({
"spv.sampleMaskOverrideCoverage.frag",
"spv.GeometryShaderPassthrough.geom",
"spv.viewportArray2.vert",
"spv.viewportArray2.tesc",
"spv.stereoViewRendering.vert",
"spv.stereoViewRendering.tesc",
"spv.multiviewPerViewAttributes.vert",
"spv.multiviewPerViewAttributes.tesc",
"spv.atomicInt64.comp",
})),
FileNameAsCustomTestSuffix
);
#endif
INSTANTIATE_TEST_CASE_P(
Glsl, CompileUpgradeTextureToSampledTextureAndDropSamplersTest,
::testing::ValuesIn(std::vector<std::string>({
"spv.texture.sampler.transform.frag",
})),
FileNameAsCustomTestSuffix
);
// clang-format on
} // anonymous namespace