yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
8f94d3bc
16.4.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"constFoldIntMin.frag" , 139"errors.frag" , 140"forwardRef.frag" , 141"uint.frag" , 142"switch.frag" , 143"tokenLength.vert" , 144"100Limits.vert" , 145"100scope.vert" , 146"110scope.vert" , 147"300scope.vert" , 148"400.frag" , 149"400.vert" , 150"410.vert" , 151"420.comp" , 152"420.frag" , 153"420.vert" , 154"420.geom" , 155"420_size_gl_in.geom" , 156"430scope.vert" , 157"lineContinuation100.vert" , 158"lineContinuation.vert" , 159"numeral.frag" , 160"400.geom" , 161"400.tesc" , 162"400.tese" , 163"410.tesc" , 164"420.tesc" , 165"420.tese" , 166"410.geom" , 167"430.vert" , 168"430.comp" , 169"430AofA.frag" , 170"435.vert" , 171"440.vert" , 172"440.frag" , 173"450.vert" , 174"450.geom" , 175"450.tesc" , 176"450.tese" , 177"450.frag" , 178"450.comp" , 179"460.frag" , 180"460.vert" , 181"dce.frag" , 182"atomic_uint.frag" , 183"implicitInnerAtomicUint.frag" , 184"aggOps.frag" , 185"always-discard.frag" , 186"always-discard2.frag" , 187"boolinput.error.frag" , 188"booloutput.error.vert" , 189"conditionalDiscard.frag" , 190"conservativeDepth.frag" , 191"conversion.frag" , 192"dataOut.frag" , 193"dataOutIndirect.frag" , 194"deepRvalue.frag" , 195"defaultArgs.comp" , 196"depthOut.frag" , 197"discard-dce.frag" , 198"doWhileLoop.frag" , 199"earlyReturnDiscard.frag" , 200"flowControl.frag" , 201"forLoop.frag" , 202"functionCall.frag" , 203"functionSemantics.frag" , 204"length.frag" , 205"localAggregates.frag" , 206"loops.frag" , 207"loopsArtificial.frag" , 208"matrix.frag" , 209"matrix2.frag" , 210"mixedArrayDecls.frag" , 211"nonuniform.frag" , 212"newTexture.frag" , 213"Operations.frag" , 214"overlongLiteral.frag" , 215"prepost.frag" , 216"runtimeArray.vert" , 217"simpleFunctionCall.frag" , 218"stringToDouble.vert" , 219"stringInvalidOps.frag" , 220"struct.error.frag" , 221"structAssignment.frag" , 222"structDeref.frag" , 223"structure.frag" , 224"swizzle.frag" , 225"invalidSwizzle.vert" , 226"syntaxError.frag" , 227"test.frag" , 228"texture.frag" , 229"tokenPaste.vert" , 230"types.frag" , 231"uniformArray.frag" , 232"variableArrayIndex.frag" , 233"variadic.comp" , 234"varyingArray.frag" , 235"varyingArrayIndirect.frag" , 236"voidFunction.frag" , 237"whileLoop.frag" , 238"nonVulkan.frag" , 239"negativeArraySize.comp" , 240"precise.tesc" , 241"precise_struct_block.vert" , 242"maxClipDistances.vert" , 243"findFunction.frag" , 244"noMatchingFunction.frag" , 245"constantUnaryConversion.comp" , 246"xfbUnsizedArray.error.vert" , 247"xfbUnsizedArray.error.tese" , 248"glsl.140.layoutOffset.error.vert" , 249"glsl.430.layoutOffset.error.vert" , 250"glsl.450.subgroup.frag" , 251"glsl.450.subgroup.geom" , 252"glsl.450.subgroup.tesc" , 253"glsl.450.subgroup.tese" , 254"glsl.450.subgroup.vert" , 255"glsl.450.subgroupArithmetic.comp" , 256"glsl.450.subgroupBasic.comp" , 257"glsl.450.subgroupBallot.comp" , 258"glsl.450.subgroupBallotNeg.comp" , 259"glsl.450.subgroupClustered.comp" , 260"glsl.450.subgroupClusteredNeg.comp" , 261"glsl.450.subgroupPartitioned.comp" , 262"glsl.450.subgroupRotate.comp" , 263"glsl.450.subgroupShuffle.comp" , 264"glsl.450.subgroupShuffleRelative.comp" , 265"glsl.450.subgroupQuad.comp" , 266"glsl.450.subgroupVote.comp" , 267"glsl.460.subgroup.mesh" , 268"glsl.460.subgroup.task" , 269"glsl.460.subgroup.rahit" , 270"glsl.460.subgroup.rcall" , 271"glsl.460.subgroup.rchit" , 272"glsl.460.subgroup.rgen" , 273"glsl.460.subgroup.rint" , 274"glsl.460.subgroup.rmiss" , 275"glsl.es300.layoutOffset.error.vert" , 276"glsl.es320.subgroup.frag" , 277"glsl.es320.subgroup.geom" , 278"glsl.es320.subgroup.tesc" , 279"glsl.es320.subgroup.tese" , 280"glsl.es320.subgroup.vert" , 281"glsl.es320.subgroupArithmetic.comp" , 282"glsl.es320.subgroupBasic.comp" , 283"glsl.es320.subgroupBallot.comp" , 284"glsl.es320.subgroupBallotNeg.comp" , 285"glsl.es320.subgroupClustered.comp" , 286"glsl.es320.subgroupClusteredNeg.comp" , 287"glsl.es320.subgroupPartitioned.comp" , 288"glsl.es320.subgroupRotate.comp" , 289"glsl.es320.subgroupShuffle.comp" , 290"glsl.es320.subgroupShuffleRelative.comp" , 291"glsl.es320.subgroupQuad.comp" , 292"glsl.es320.subgroupVote.comp" , 293"glsl.es320.extTextureShadowLod.frag" , 294"gl_samplemask_array_size.frag" , 295"glsl.ext.textureShadowLod.frag" , 296"terminate.frag" , 297"terminate.vert" , 298"negativeWorkGroupSize.comp" , 299"textureoffset_sampler2darrayshadow.vert" , 300"atomicAdd.comp" , 301"GL_ARB_gpu_shader5.u2i.vert" , 302"glsl.arbgpushader5.frag" , 303"textureQueryLOD.frag" , 304"atomicCounterARBOps.vert" , 305"GL_EXT_shader_integer_mix.vert" , 306"GL_ARB_draw_instanced.vert" , 307"GL_ARB_fragment_coord_conventions.vert" , 308"GL_ARB_bindless_texture.frag" , 309"GL_ARB_texture_multisample.vert" , 310"BestMatchFunction.vert" , 311"EndStreamPrimitive.geom" , 312"floatBitsToInt.vert" , 313"coord_conventions.frag" , 314"gl_FragCoord.frag" , 315"glsl.interpOp.error.frag" , 316"location_aliasing.tesc" , 317"location_aliasing1.frag" , 318"GL_EXT_draw_instanced.vert" , 319"overflow_underflow_toinf_0.frag" , 320"GL_EXT_texture_array.frag" , 321"index_outside_sample_mask_range.frag" , 322"positive_infinity.frag" , 323"matrixCompMult.vert" , 324"ps_uint_int.frag" , 325"ps_sample.frag" , 326"tes_patch.tese" , 327})) , 328FileNameAsCustomTestSuffix 329) ; 330 331INSTANTIATE_TEST_SUITE_P ( 332Glsl , CompileToAstTestNV , 333:: testing :: ValuesIn ( std :: vector < std :: string > ({ 334"nvShaderNoperspectiveInterpolation.frag" , 335"glsl.nvgpushader5.frag" , 336"glsl.nvgpushader5.geom" , 337"glsl.nvgpushader5.vert" , 338})) , 339FileNameAsCustomTestSuffix 340) ; 341 342// clang-format on 343 344} // anonymous namespace 345} // namespace glslangtest