2 // Copyright (C) 2016 Google, Inc.
4 // All rights reserved.
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions
10 // Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
13 // Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following
15 // disclaimer in the documentation and/or other materials provided
16 // with the distribution.
18 // Neither the name of Google Inc. nor the names of its
19 // contributors may be used to endorse or promote products derived
20 // from this software without specific prior written permission.
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 // POSSIBILITY OF SUCH DAMAGE.
35 #include <gtest/gtest.h>
37 #include "TestFixture.h"
39 namespace glslangtest {
42 using CompileToAstTest = GlslangTest<::testing::TestWithParam<std::string>>;
44 using CompileToAstTestNV = GlslangTest<::testing::TestWithParam<std::string>>;
46 TEST_P(CompileToAstTest, FromFile)
48 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
49 Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
53 // Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled).
54 TEST_P(CompileToAstTestNV, FromFile)
56 loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(),
57 Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0,
62 INSTANTIATE_TEST_SUITE_P(
63 Glsl, CompileToAstTest,
64 ::testing::ValuesIn(std::vector<std::string>({
72 "versionsErrors.frag",
73 "versionsErrors.vert",
75 "100samplerExternal.frag",
91 "cppIntMinOverNegativeOne.frag",
99 "cppComplexExpr.vert",
101 "cppPassMacroName.frag",
102 "cppRelaxSkipTokensErrors.vert",
113 "300operations.frag",
115 "300samplerExternal.frag",
116 "300samplerExternalYUV.frag",
123 "310implicitSizeArrayError.vert",
124 "310.inheritMemory.frag",
126 "310runtimeArray.vert",
137 "constFoldIntMin.frag",
154 "420_size_gl_in.geom",
156 "lineContinuation100.vert",
157 "lineContinuation.vert",
182 "implicitInnerAtomicUint.frag",
184 "always-discard.frag",
185 "always-discard2.frag",
186 "conditionalDiscard.frag",
189 "dataOutIndirect.frag",
194 "earlyReturnDiscard.frag",
198 "functionSemantics.frag",
200 "localAggregates.frag",
202 "loopsArtificial.frag",
205 "mixedArrayDecls.frag",
209 "overlongLiteral.frag",
212 "simpleFunctionCall.frag",
213 "stringToDouble.vert",
214 "structAssignment.frag",
218 "invalidSwizzle.vert",
225 "variableArrayIndex.frag",
227 "varyingArrayIndirect.frag",
231 "negativeArraySize.comp",
233 "precise_struct_block.vert",
234 "maxClipDistances.vert",
236 "noMatchingFunction.frag",
237 "constantUnaryConversion.comp",
238 "xfbUnsizedArray.error.vert",
239 "glsl.140.layoutOffset.error.vert",
240 "glsl.430.layoutOffset.error.vert",
241 "glsl.450.subgroup.frag",
242 "glsl.450.subgroup.geom",
243 "glsl.450.subgroup.tesc",
244 "glsl.450.subgroup.tese",
245 "glsl.450.subgroup.vert",
246 "glsl.450.subgroupArithmetic.comp",
247 "glsl.450.subgroupBasic.comp",
248 "glsl.450.subgroupBallot.comp",
249 "glsl.450.subgroupBallotNeg.comp",
250 "glsl.450.subgroupClustered.comp",
251 "glsl.450.subgroupClusteredNeg.comp",
252 "glsl.450.subgroupPartitioned.comp",
253 "glsl.450.subgroupShuffle.comp",
254 "glsl.450.subgroupShuffleRelative.comp",
255 "glsl.450.subgroupQuad.comp",
256 "glsl.450.subgroupVote.comp",
257 "glsl.460.subgroup.mesh",
258 "glsl.460.subgroup.task",
259 "glsl.460.subgroup.rahit",
260 "glsl.460.subgroup.rcall",
261 "glsl.460.subgroup.rchit",
262 "glsl.460.subgroup.rgen",
263 "glsl.460.subgroup.rint",
264 "glsl.460.subgroup.rmiss",
265 "glsl.es300.layoutOffset.error.vert",
266 "glsl.es320.subgroup.frag",
267 "glsl.es320.subgroup.geom",
268 "glsl.es320.subgroup.tesc",
269 "glsl.es320.subgroup.tese",
270 "glsl.es320.subgroup.vert",
271 "glsl.es320.subgroupArithmetic.comp",
272 "glsl.es320.subgroupBasic.comp",
273 "glsl.es320.subgroupBallot.comp",
274 "glsl.es320.subgroupBallotNeg.comp",
275 "glsl.es320.subgroupClustered.comp",
276 "glsl.es320.subgroupClusteredNeg.comp",
277 "glsl.es320.subgroupPartitioned.comp",
278 "glsl.es320.subgroupShuffle.comp",
279 "glsl.es320.subgroupShuffleRelative.comp",
280 "glsl.es320.subgroupQuad.comp",
281 "glsl.es320.subgroupVote.comp",
284 "negativeWorkGroupSize.comp",
285 "textureoffset_sampler2darrayshadow.vert",
287 "GL_ARB_gpu_shader5.u2i.vert",
288 "textureQueryLOD.frag",
289 "atomicCounterARBOps.vert",
290 "GL_EXT_shader_integer_mix.vert",
291 "GL_ARB_draw_instanced.vert",
292 "GL_ARB_fragment_coord_conventions.vert",
293 "BestMatchFunction.vert",
295 FileNameAsCustomTestSuffix
298 INSTANTIATE_TEST_SUITE_P(
299 Glsl, CompileToAstTestNV,
300 ::testing::ValuesIn(std::vector<std::string>({
301 "nvShaderNoperspectiveInterpolation.frag",
303 FileNameAsCustomTestSuffix
308 } // anonymous namespace
309 } // namespace glslangtest