2016-03-04 21:22:34 +00:00
|
|
|
//
|
|
|
|
// Copyright (C) 2016 Google, Inc.
|
2024-02-06 15:20:16 +00:00
|
|
|
// Copyright (C) 2022-2024 Arm Limited.
|
2016-03-04 21:22:34 +00:00
|
|
|
//
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions
|
|
|
|
// are met:
|
|
|
|
//
|
|
|
|
// Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
//
|
|
|
|
// Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
//
|
|
|
|
// Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "TestFixture.h"
|
|
|
|
|
|
|
|
namespace glslangtest {
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>;
|
|
|
|
|
2018-03-16 13:15:48 +00:00
|
|
|
using CompileToAstTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
|
|
|
|
|
2016-03-04 21:22:34 +00:00
|
|
|
TEST_P(CompileToAstTest, FromFile)
|
|
|
|
{
|
2016-10-05 14:25:09 +00:00
|
|
|
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
2019-01-04 10:10:53 +00:00
|
|
|
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
2016-05-16 16:50:30 +00:00
|
|
|
Target::AST);
|
2016-03-04 21:22:34 +00:00
|
|
|
}
|
|
|
|
|
2018-03-16 13:15:48 +00:00
|
|
|
// Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled).
|
|
|
|
TEST_P(CompileToAstTestNV, FromFile)
|
|
|
|
{
|
|
|
|
loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
|
2019-01-04 10:10:53 +00:00
|
|
|
Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
|
2018-03-16 13:15:48 +00:00
|
|
|
Target::AST);
|
|
|
|
}
|
|
|
|
|
2016-03-04 21:22:34 +00:00
|
|
|
// clang-format off
|
2020-08-05 11:23:04 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2016-03-04 21:22:34 +00:00
|
|
|
Glsl, CompileToAstTest,
|
|
|
|
::testing::ValuesIn(std::vector<std::string>({
|
|
|
|
"sample.frag",
|
|
|
|
"sample.vert",
|
|
|
|
"decls.frag",
|
|
|
|
"specExamples.frag",
|
|
|
|
"specExamples.vert",
|
|
|
|
"versionsClean.frag",
|
|
|
|
"versionsClean.vert",
|
|
|
|
"versionsErrors.frag",
|
|
|
|
"versionsErrors.vert",
|
|
|
|
"100.frag",
|
2017-09-04 16:33:04 +00:00
|
|
|
"100samplerExternal.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"120.vert",
|
|
|
|
"120.frag",
|
|
|
|
"130.vert",
|
|
|
|
"130.frag",
|
|
|
|
"140.vert",
|
|
|
|
"140.frag",
|
|
|
|
"150.vert",
|
|
|
|
"150.geom",
|
|
|
|
"150.frag",
|
|
|
|
"precision.frag",
|
|
|
|
"precision.vert",
|
|
|
|
"nonSquare.vert",
|
|
|
|
"matrixError.vert",
|
|
|
|
"cppSimple.vert",
|
|
|
|
"cppIndent.vert",
|
2017-10-28 18:55:02 +00:00
|
|
|
"cppIntMinOverNegativeOne.frag",
|
2019-02-20 10:03:40 +00:00
|
|
|
"cppMerge.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"cppNest.vert",
|
2016-07-30 18:38:17 +00:00
|
|
|
"cppBad.vert",
|
2017-01-03 00:56:08 +00:00
|
|
|
"cppBad2.vert",
|
2019-02-11 10:05:00 +00:00
|
|
|
"cppBad3.vert",
|
2019-02-16 14:35:13 +00:00
|
|
|
"cppBad4.vert",
|
|
|
|
"cppBad5.vert",
|
2016-03-04 21:22:34 +00:00
|
|
|
"cppComplexExpr.vert",
|
2017-10-16 21:29:07 +00:00
|
|
|
"cppDeepNest.frag",
|
2017-11-02 12:48:32 +00:00
|
|
|
"cppPassMacroName.frag",
|
2018-03-19 06:43:18 +00:00
|
|
|
"cppRelaxSkipTokensErrors.vert",
|
2016-03-04 21:22:34 +00:00
|
|
|
"badChars.frag",
|
|
|
|
"pointCoord.frag",
|
|
|
|
"array.frag",
|
|
|
|
"array100.frag",
|
|
|
|
"comment.frag",
|
|
|
|
"300.vert",
|
|
|
|
"300.frag",
|
|
|
|
"300BuiltIns.frag",
|
|
|
|
"300layout.vert",
|
|
|
|
"300layout.frag",
|
|
|
|
"300operations.frag",
|
|
|
|
"300block.frag",
|
2017-09-04 16:33:04 +00:00
|
|
|
"300samplerExternal.frag",
|
2019-01-24 20:12:20 +00:00
|
|
|
"300samplerExternalYUV.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"310.comp",
|
|
|
|
"310.vert",
|
|
|
|
"310.geom",
|
|
|
|
"310.frag",
|
|
|
|
"310.tesc",
|
|
|
|
"310.tese",
|
|
|
|
"310implicitSizeArrayError.vert",
|
2019-08-22 12:58:26 +00:00
|
|
|
"310.inheritMemory.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"310AofA.vert",
|
2018-04-05 17:25:02 +00:00
|
|
|
"310runtimeArray.vert",
|
2017-07-23 19:54:15 +00:00
|
|
|
"320.comp",
|
|
|
|
"320.vert",
|
|
|
|
"320.geom",
|
|
|
|
"320.frag",
|
|
|
|
"320.tesc",
|
|
|
|
"320.tese",
|
2016-03-04 21:22:34 +00:00
|
|
|
"330.frag",
|
|
|
|
"330comp.frag",
|
|
|
|
"constErrors.frag",
|
|
|
|
"constFold.frag",
|
2017-10-28 18:55:02 +00:00
|
|
|
"constFoldIntMin.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"errors.frag",
|
|
|
|
"forwardRef.frag",
|
|
|
|
"uint.frag",
|
|
|
|
"switch.frag",
|
|
|
|
"tokenLength.vert",
|
|
|
|
"100Limits.vert",
|
|
|
|
"100scope.vert",
|
|
|
|
"110scope.vert",
|
|
|
|
"300scope.vert",
|
|
|
|
"400.frag",
|
2016-06-06 00:52:05 +00:00
|
|
|
"400.vert",
|
|
|
|
"410.vert",
|
2016-05-30 00:24:31 +00:00
|
|
|
"420.comp",
|
2016-03-04 21:22:34 +00:00
|
|
|
"420.frag",
|
|
|
|
"420.vert",
|
|
|
|
"420.geom",
|
|
|
|
"420_size_gl_in.geom",
|
|
|
|
"430scope.vert",
|
|
|
|
"lineContinuation100.vert",
|
|
|
|
"lineContinuation.vert",
|
|
|
|
"numeral.frag",
|
|
|
|
"400.geom",
|
|
|
|
"400.tesc",
|
|
|
|
"400.tese",
|
|
|
|
"410.tesc",
|
|
|
|
"420.tesc",
|
|
|
|
"420.tese",
|
|
|
|
"410.geom",
|
|
|
|
"430.vert",
|
|
|
|
"430.comp",
|
|
|
|
"430AofA.frag",
|
2017-07-23 17:49:42 +00:00
|
|
|
"435.vert",
|
2016-03-04 21:22:34 +00:00
|
|
|
"440.vert",
|
|
|
|
"440.frag",
|
|
|
|
"450.vert",
|
|
|
|
"450.geom",
|
|
|
|
"450.tesc",
|
|
|
|
"450.tese",
|
|
|
|
"450.frag",
|
|
|
|
"450.comp",
|
2017-07-23 20:44:59 +00:00
|
|
|
"460.frag",
|
|
|
|
"460.vert",
|
2016-03-04 21:22:34 +00:00
|
|
|
"dce.frag",
|
|
|
|
"atomic_uint.frag",
|
2017-11-02 06:05:53 +00:00
|
|
|
"implicitInnerAtomicUint.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"aggOps.frag",
|
|
|
|
"always-discard.frag",
|
|
|
|
"always-discard2.frag",
|
|
|
|
"conditionalDiscard.frag",
|
|
|
|
"conversion.frag",
|
|
|
|
"dataOut.frag",
|
|
|
|
"dataOutIndirect.frag",
|
|
|
|
"deepRvalue.frag",
|
|
|
|
"depthOut.frag",
|
|
|
|
"discard-dce.frag",
|
|
|
|
"doWhileLoop.frag",
|
|
|
|
"earlyReturnDiscard.frag",
|
|
|
|
"flowControl.frag",
|
|
|
|
"forLoop.frag",
|
|
|
|
"functionCall.frag",
|
|
|
|
"functionSemantics.frag",
|
|
|
|
"length.frag",
|
|
|
|
"localAggregates.frag",
|
|
|
|
"loops.frag",
|
|
|
|
"loopsArtificial.frag",
|
|
|
|
"matrix.frag",
|
|
|
|
"matrix2.frag",
|
2018-03-26 06:38:53 +00:00
|
|
|
"mixedArrayDecls.frag",
|
2018-04-05 17:25:02 +00:00
|
|
|
"nonuniform.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"newTexture.frag",
|
|
|
|
"Operations.frag",
|
2017-10-22 17:41:13 +00:00
|
|
|
"overlongLiteral.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"prepost.frag",
|
2018-04-02 20:52:15 +00:00
|
|
|
"runtimeArray.vert",
|
2016-03-04 21:22:34 +00:00
|
|
|
"simpleFunctionCall.frag",
|
2018-05-25 00:11:47 +00:00
|
|
|
"stringToDouble.vert",
|
2023-01-11 01:50:18 +00:00
|
|
|
"struct.error.frag",
|
2016-03-04 21:22:34 +00:00
|
|
|
"structAssignment.frag",
|
|
|
|
"structDeref.frag",
|
|
|
|
"structure.frag",
|
|
|
|
"swizzle.frag",
|
2017-10-17 08:11:33 +00:00
|
|
|
"invalidSwizzle.vert",
|
2016-03-04 21:22:34 +00:00
|
|
|
"syntaxError.frag",
|
|
|
|
"test.frag",
|
|
|
|
"texture.frag",
|
2016-12-19 16:19:43 +00:00
|
|
|
"tokenPaste.vert",
|
2016-03-04 21:22:34 +00:00
|
|
|
"types.frag",
|
|
|
|
"uniformArray.frag",
|
|
|
|
"variableArrayIndex.frag",
|
|
|
|
"varyingArray.frag",
|
|
|
|
"varyingArrayIndirect.frag",
|
|
|
|
"voidFunction.frag",
|
|
|
|
"whileLoop.frag",
|
|
|
|
"nonVulkan.frag",
|
2016-05-04 18:35:16 +00:00
|
|
|
"negativeArraySize.comp",
|
|
|
|
"precise.tesc",
|
|
|
|
"precise_struct_block.vert",
|
|
|
|
"maxClipDistances.vert",
|
2018-03-06 23:12:04 +00:00
|
|
|
"findFunction.frag",
|
2021-12-28 22:17:39 +00:00
|
|
|
"noMatchingFunction.frag",
|
2019-03-26 17:45:33 +00:00
|
|
|
"constantUnaryConversion.comp",
|
2020-06-09 08:30:14 +00:00
|
|
|
"xfbUnsizedArray.error.vert",
|
2021-12-23 21:53:44 +00:00
|
|
|
"xfbUnsizedArray.error.tese",
|
2020-06-09 08:30:14 +00:00
|
|
|
"glsl.140.layoutOffset.error.vert",
|
|
|
|
"glsl.430.layoutOffset.error.vert",
|
2019-03-26 17:45:33 +00:00
|
|
|
"glsl.450.subgroup.frag",
|
|
|
|
"glsl.450.subgroup.geom",
|
|
|
|
"glsl.450.subgroup.tesc",
|
|
|
|
"glsl.450.subgroup.tese",
|
|
|
|
"glsl.450.subgroup.vert",
|
|
|
|
"glsl.450.subgroupArithmetic.comp",
|
|
|
|
"glsl.450.subgroupBasic.comp",
|
|
|
|
"glsl.450.subgroupBallot.comp",
|
|
|
|
"glsl.450.subgroupBallotNeg.comp",
|
|
|
|
"glsl.450.subgroupClustered.comp",
|
|
|
|
"glsl.450.subgroupClusteredNeg.comp",
|
|
|
|
"glsl.450.subgroupPartitioned.comp",
|
2024-02-06 15:20:16 +00:00
|
|
|
"glsl.450.subgroupRotate.comp",
|
2019-03-26 17:45:33 +00:00
|
|
|
"glsl.450.subgroupShuffle.comp",
|
|
|
|
"glsl.450.subgroupShuffleRelative.comp",
|
|
|
|
"glsl.450.subgroupQuad.comp",
|
|
|
|
"glsl.450.subgroupVote.comp",
|
2019-05-30 05:08:41 +00:00
|
|
|
"glsl.460.subgroup.mesh",
|
|
|
|
"glsl.460.subgroup.task",
|
2019-05-30 23:40:20 +00:00
|
|
|
"glsl.460.subgroup.rahit",
|
|
|
|
"glsl.460.subgroup.rcall",
|
|
|
|
"glsl.460.subgroup.rchit",
|
|
|
|
"glsl.460.subgroup.rgen",
|
|
|
|
"glsl.460.subgroup.rint",
|
|
|
|
"glsl.460.subgroup.rmiss",
|
2020-06-09 08:30:14 +00:00
|
|
|
"glsl.es300.layoutOffset.error.vert",
|
2019-03-26 17:45:33 +00:00
|
|
|
"glsl.es320.subgroup.frag",
|
|
|
|
"glsl.es320.subgroup.geom",
|
|
|
|
"glsl.es320.subgroup.tesc",
|
|
|
|
"glsl.es320.subgroup.tese",
|
|
|
|
"glsl.es320.subgroup.vert",
|
|
|
|
"glsl.es320.subgroupArithmetic.comp",
|
|
|
|
"glsl.es320.subgroupBasic.comp",
|
|
|
|
"glsl.es320.subgroupBallot.comp",
|
|
|
|
"glsl.es320.subgroupBallotNeg.comp",
|
|
|
|
"glsl.es320.subgroupClustered.comp",
|
|
|
|
"glsl.es320.subgroupClusteredNeg.comp",
|
|
|
|
"glsl.es320.subgroupPartitioned.comp",
|
2024-02-06 15:20:16 +00:00
|
|
|
"glsl.es320.subgroupRotate.comp",
|
2019-03-26 17:45:33 +00:00
|
|
|
"glsl.es320.subgroupShuffle.comp",
|
|
|
|
"glsl.es320.subgroupShuffleRelative.comp",
|
|
|
|
"glsl.es320.subgroupQuad.comp",
|
|
|
|
"glsl.es320.subgroupVote.comp",
|
2023-10-02 19:10:11 +00:00
|
|
|
"glsl.es320.extTextureShadowLod.frag",
|
2023-12-29 21:23:16 +00:00
|
|
|
"gl_samplemask_array_size.frag",
|
2023-10-02 19:10:11 +00:00
|
|
|
"glsl.ext.textureShadowLod.frag",
|
2020-11-09 16:30:01 +00:00
|
|
|
"terminate.frag",
|
|
|
|
"terminate.vert",
|
2021-02-23 01:21:25 +00:00
|
|
|
"negativeWorkGroupSize.comp",
|
2021-04-17 00:52:51 +00:00
|
|
|
"textureoffset_sampler2darrayshadow.vert",
|
2021-07-12 08:57:25 +00:00
|
|
|
"atomicAdd.comp",
|
2021-07-19 09:24:28 +00:00
|
|
|
"GL_ARB_gpu_shader5.u2i.vert",
|
2021-08-02 08:20:02 +00:00
|
|
|
"textureQueryLOD.frag",
|
2021-08-02 03:10:33 +00:00
|
|
|
"atomicCounterARBOps.vert",
|
2021-08-02 06:52:11 +00:00
|
|
|
"GL_EXT_shader_integer_mix.vert",
|
|
|
|
"GL_ARB_draw_instanced.vert",
|
2021-11-24 18:52:08 +00:00
|
|
|
"GL_ARB_fragment_coord_conventions.vert",
|
2022-11-15 16:04:55 +00:00
|
|
|
"GL_ARB_bindless_texture.frag",
|
2023-12-28 23:38:39 +00:00
|
|
|
"GL_ARB_texture_multisample.vert",
|
2021-08-02 08:41:21 +00:00
|
|
|
"BestMatchFunction.vert",
|
2022-01-10 18:49:19 +00:00
|
|
|
"EndStreamPrimitive.geom",
|
2022-01-07 05:50:30 +00:00
|
|
|
"floatBitsToInt.vert",
|
2022-03-01 07:06:04 +00:00
|
|
|
"coord_conventions.frag",
|
2023-09-12 20:35:50 +00:00
|
|
|
"gl_FragCoord.frag",
|
|
|
|
"glsl.interpOp.error.frag",
|
2024-04-26 16:05:08 +00:00
|
|
|
"location_aliasing.tesc",
|
|
|
|
"location_aliasing1.frag",
|
2023-12-12 23:22:04 +00:00
|
|
|
"GL_EXT_draw_instanced.vert",
|
2023-11-28 00:26:25 +00:00
|
|
|
"overflow_underflow_toinf_0.frag",
|
2023-12-11 09:10:36 +00:00
|
|
|
"GL_EXT_texture_array.frag",
|
2024-04-18 00:14:26 +00:00
|
|
|
"index_outside_sample_mask_range.frag",
|
2024-03-25 08:10:18 +00:00
|
|
|
"positive_infinity.frag",
|
2024-07-15 18:24:16 +00:00
|
|
|
"matrixCompMult.vert",
|
2024-07-17 22:23:38 +00:00
|
|
|
"ps_uint_int.frag",
|
|
|
|
"ps_sample.frag",
|
|
|
|
"tes_patch.tese",
|
2016-03-04 21:22:34 +00:00
|
|
|
})),
|
2016-05-16 16:50:30 +00:00
|
|
|
FileNameAsCustomTestSuffix
|
2016-03-04 21:22:34 +00:00
|
|
|
);
|
2018-03-16 13:15:48 +00:00
|
|
|
|
2020-08-05 11:23:04 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-03-16 13:15:48 +00:00
|
|
|
Glsl, CompileToAstTestNV,
|
|
|
|
::testing::ValuesIn(std::vector<std::string>({
|
|
|
|
"nvShaderNoperspectiveInterpolation.frag",
|
|
|
|
})),
|
|
|
|
FileNameAsCustomTestSuffix
|
|
|
|
);
|
2020-06-09 08:30:14 +00:00
|
|
|
|
2016-03-04 21:22:34 +00:00
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
} // namespace glslangtest
|