yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
90afccfb
vulkan-sdk-1.4.363.0
1// 2// Copyright (C) 2016 Google, Inc. 3// Copyright (C) 2022-2024 Arm Limited. 4// 5// All rights reserved. 6// 7// Redistribution and use in source and binary forms, with or without 8// modification, are permitted provided that the following conditions 9// are met: 10// 11// Redistributions of source code must retain the above copyright 12// notice, this list of conditions and the following disclaimer. 13// 14// Redistributions in binary form must reproduce the above 15// copyright notice, this list of conditions and the following 16// disclaimer in the documentation and/or other materials provided 17// with the distribution. 18// 19// Neither the name of Google Inc. nor the names of its 20// contributors may be used to endorse or promote products derived 21// from this software without specific prior written permission. 22// 23// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34// POSSIBILITY OF SUCH DAMAGE. 35 36#include <gtest/gtest.h> 37 38#include "TestFixture.h" 39 40namespace glslangtest { 41namespace { 42 43using CompileToAstTest = GlslangTest <:: testing :: TestWithParam < std :: string >> ; 44 45using CompileToAstTestNV = GlslangTest <:: testing :: TestWithParam < std :: string >> ; 46 47TEST_P ( CompileToAstTest , FromFile ) 48{ 49loadFileCompileAndCheck ( GlobalTestSettings . testRoot , GetParam () , 50Source :: GLSL , Semantics :: OpenGL , glslang :: EShTargetVulkan_1_0 , glslang :: EShTargetSpv_1_0 , 51Target :: AST ) ; 52} 53 54// Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled). 55TEST_P ( CompileToAstTestNV , FromFile ) 56{ 57loadFileCompileAndCheck ( GlobalTestSettings . testRoot , GetParam () , 58Source :: GLSL , Semantics :: OpenGL , glslang :: EShTargetVulkan_1_0 , glslang :: EShTargetSpv_1_0 , 59Target :: AST ) ; 60} 61 62// clang-format off 63INSTANTIATE_TEST_SUITE_P ( 64Glsl , CompileToAstTest , 65:: testing :: ValuesIn ( std :: vector < std :: string > ({ 66"sample.frag" , 67"sample.vert" , 68"decls.frag" , 69"specExamples.frag" , 70"specExamples.vert" , 71"versionsClean.frag" , 72"versionsClean.vert" , 73"versionsErrors.frag" , 74"versionsErrors.vert" , 75"100.frag" , 76"100samplerExternal.frag" , 77"120.vert" , 78"120.frag" , 79"130.vert" , 80"130.frag" , 81"140.vert" , 82"140.frag" , 83"150.vert" , 84"150.geom" , 85"150.frag" , 86"precision.frag" , 87"precision.vert" , 88"nonSquare.vert" , 89"matrixError.vert" , 90"cppSimple.vert" , 91"cppIndent.vert" , 92"cppIntMinOverNegativeOne.frag" , 93"cppMerge.frag" , 94"cppNest.vert" , 95"cppBad.vert" , 96"cppBad2.vert" , 97"cppBad3.vert" , 98"cppBad4.vert" , 99"cppBad5.vert" , 100"cppComplexExpr.vert" , 101"cppDeepNest.frag" , 102"cppPassMacroName.frag" , 103"cppRelaxSkipTokensErrors.vert" , 104"badChars.frag" , 105"pointCoord.frag" , 106"array.frag" , 107"array100.frag" , 108"comment.frag" , 109"300.vert" , 110"300.frag" , 111"300BuiltIns.frag" , 112"300layout.vert" , 113"300layout.frag" , 114"300operations.frag" , 115"300block.frag" , 116"300samplerExternal.frag" , 117"300samplerExternalYUV.frag" , 118"310.comp" , 119"310.vert" , 120"310.geom" , 121"310.frag" , 122"310.tesc" , 123"310.tese" , 124"310implicitSizeArrayError.vert" , 125"310.inheritMemory.frag" , 126"310AofA.vert" , 127"310runtimeArray.vert" , 128"320.comp" , 129"320.vert" , 130"320.geom" , 131"320.frag" , 132"320.tesc" , 133"320.tese" , 134"330.frag" , 135"330comp.frag" , 136"constErrors.frag" , 137"constFold.frag" , 138"constFoldBitCast64.frag" , 139"constFoldIntMin.frag" , 140"errors.frag" , 141"forwardRef.frag" , 142"uint.frag" , 143"switch.frag" , 144"tokenLength.vert" , 145"100Limits.vert" , 146"100scope.vert" , 147"110scope.vert" , 148"300scope.vert" , 149"400.frag" , 150"400.vert" , 151"410.vert" , 152"420.comp" , 153"420.frag" , 154"420.vert" , 155"420.geom" , 156"420_size_gl_in.geom" , 157"430scope.vert" , 158"lineContinuation100.vert" , 159"lineContinuation.vert" , 160"numeral.frag" , 161"400.geom" , 162"400.tesc" , 163"400.tese" , 164"410.tesc" , 165"420.tesc" , 166"420.tese" , 167"410.geom" , 168"430.vert" , 169"430.comp" , 170"430AofA.frag" , 171"435.vert" , 172"440.vert" , 173"440.frag" , 174"450.vert" , 175"450.geom" , 176"450.tesc" , 177"450.tese" , 178"450.frag" , 179"450.comp" , 180"460.frag" , 181"460.vert" , 182"dce.frag" , 183"atomic_uint.frag" , 184"implicitInnerAtomicUint.frag" , 185"aggOps.frag" , 186"always-discard.frag" , 187"always-discard2.frag" , 188"boolinput.error.frag" , 189"booloutput.error.vert" , 190"conditionalDiscard.frag" , 191"conservativeDepth.frag" , 192"conversion.frag" , 193"dataOut.frag" , 194"dataOutIndirect.frag" , 195"deepRvalue.frag" , 196"defaultArgs.comp" , 197"depthOut.frag" , 198"discard-dce.frag" , 199"doWhileLoop.frag" , 200"earlyReturnDiscard.frag" , 201"flowControl.frag" , 202"forLoop.frag" , 203"functionCall.frag" , 204"functionSemantics.frag" , 205"length.frag" , 206"localAggregates.frag" , 207"loops.frag" , 208"loopsArtificial.frag" , 209"matrix.frag" , 210"matrix2.frag" , 211"mixedArrayDecls.frag" , 212"nonuniform.frag" , 213"newTexture.frag" , 214"Operations.frag" , 215"overlongLiteral.frag" , 216"prepost.frag" , 217"runtimeArray.vert" , 218"simpleFunctionCall.frag" , 219"stringToDouble.vert" , 220"stringInvalidOps.frag" , 221"struct.error.frag" , 222"structAssignment.frag" , 223"structDeref.frag" , 224"structure.frag" , 225"swizzle.frag" , 226"invalidSwizzle.vert" , 227"syntaxError.frag" , 228"test.frag" , 229"texture.frag" , 230"tokenPaste.vert" , 231"types.frag" , 232"uniformArray.frag" , 233"variableArrayIndex.frag" , 234"variadic.comp" , 235"varyingArray.frag" , 236"varyingArrayIndirect.frag" , 237"voidFunction.frag" , 238"whileLoop.frag" , 239"nonVulkan.frag" , 240"negativeArraySize.comp" , 241"precise.tesc" , 242"precise_struct_block.vert" , 243"maxClipDistances.vert" , 244"findFunction.frag" , 245"noMatchingFunction.frag" , 246"constantUnaryConversion.comp" , 247"xfbUnsizedArray.error.vert" , 248"xfbUnsizedArray.error.tese" , 249"glsl.140.layoutOffset.error.vert" , 250"glsl.430.layoutOffset.error.vert" , 251"glsl.450.subgroup.frag" , 252"glsl.450.subgroup.geom" , 253"glsl.450.subgroup.tesc" , 254"glsl.450.subgroup.tese" , 255"glsl.450.subgroup.vert" , 256"glsl.450.subgroupArithmetic.comp" , 257"glsl.450.subgroupBasic.comp" , 258"glsl.450.subgroupBallot.comp" , 259"glsl.450.subgroupBallotNeg.comp" , 260"glsl.450.subgroupClustered.comp" , 261"glsl.450.subgroupClusteredNeg.comp" , 262"glsl.450.subgroupPartitioned.comp" , 263"glsl.450.subgroupRotate.comp" , 264"glsl.450.subgroupShuffle.comp" , 265"glsl.450.subgroupShuffleRelative.comp" , 266"glsl.450.subgroupQuad.comp" , 267"glsl.450.subgroupVote.comp" , 268"glsl.460.subgroup.mesh" , 269"glsl.460.subgroup.task" , 270"glsl.460.subgroup.rahit" , 271"glsl.460.subgroup.rcall" , 272"glsl.460.subgroup.rchit" , 273"glsl.460.subgroup.rgen" , 274"glsl.460.subgroup.rint" , 275"glsl.460.subgroup.rmiss" , 276"glsl.es300.layoutOffset.error.vert" , 277"glsl.es320.subgroup.frag" , 278"glsl.es320.subgroup.geom" , 279"glsl.es320.subgroup.tesc" , 280"glsl.es320.subgroup.tese" , 281"glsl.es320.subgroup.vert" , 282"glsl.es320.subgroupArithmetic.comp" , 283"glsl.es320.subgroupBasic.comp" , 284"glsl.es320.subgroupBallot.comp" , 285"glsl.es320.subgroupBallotNeg.comp" , 286"glsl.es320.subgroupClustered.comp" , 287"glsl.es320.subgroupClusteredNeg.comp" , 288"glsl.es320.subgroupPartitioned.comp" , 289"glsl.es320.subgroupRotate.comp" , 290"glsl.es320.subgroupShuffle.comp" , 291"glsl.es320.subgroupShuffleRelative.comp" , 292"glsl.es320.subgroupQuad.comp" , 293"glsl.es320.subgroupVote.comp" , 294"glsl.es320.extTextureShadowLod.frag" , 295"gl_samplemask_array_size.frag" , 296"glsl.ext.textureShadowLod.frag" , 297"terminate.frag" , 298"terminate.vert" , 299"negativeWorkGroupSize.comp" , 300"textureoffset_sampler2darrayshadow.vert" , 301"atomicAdd.comp" , 302"GL_ARB_gpu_shader5.u2i.vert" , 303"glsl.arbgpushader5.frag" , 304"textureQueryLOD.frag" , 305"atomicCounterARBOps.vert" , 306"GL_EXT_shader_integer_mix.vert" , 307"GL_ARB_draw_instanced.vert" , 308"GL_ARB_fragment_coord_conventions.vert" , 309"GL_ARB_bindless_texture.frag" , 310"GL_ARB_texture_multisample.vert" , 311"BestMatchFunction.vert" , 312"EndStreamPrimitive.geom" , 313"floatBitsToInt.vert" , 314"coord_conventions.frag" , 315"gl_FragCoord.frag" , 316"glsl.interpOp.error.frag" , 317"glsl.nullInitializer.error.vert" , 318"location_aliasing.tesc" , 319"location_aliasing1.frag" , 320"GL_EXT_draw_instanced.vert" , 321"overflow_underflow_toinf_0.frag" , 322"GL_EXT_texture_array.frag" , 323"index_outside_sample_mask_range.frag" , 324"positive_infinity.frag" , 325"matrixCompMult.vert" , 326"ps_uint_int.frag" , 327"ps_sample.frag" , 328"tes_patch.tese" , 329})) , 330FileNameAsCustomTestSuffix 331) ; 332 333INSTANTIATE_TEST_SUITE_P ( 334Glsl , CompileToAstTestNV , 335:: testing :: ValuesIn ( std :: vector < std :: string > ({ 336"nvShaderNoperspectiveInterpolation.frag" , 337"glsl.nvgpushader5.frag" , 338"glsl.nvgpushader5.geom" , 339"glsl.nvgpushader5.vert" , 340})) , 341FileNameAsCustomTestSuffix 342) ; 343 344// clang-format on 345 346} // anonymous namespace 347} // namespace glslangtest