2013-02-12 18:26:15 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2013-08-05 15:52:03 +00:00
|
|
|
TARGETDIR=localResults
|
|
|
|
BASEDIR=baseResults
|
2014-03-11 02:10:26 +00:00
|
|
|
EXE=../build/install/bin/glslangValidator
|
2015-05-15 19:01:17 +00:00
|
|
|
HASERROR=0
|
2013-12-20 18:36:27 +00:00
|
|
|
mkdir -p localResults
|
2013-09-04 21:19:27 +00:00
|
|
|
|
2014-04-14 15:46:40 +00:00
|
|
|
if [ -a localtestlist ]
|
|
|
|
then
|
|
|
|
while read t; do
|
|
|
|
echo Running $t...
|
|
|
|
b=`basename $t`
|
|
|
|
$EXE -i -l $t > $TARGETDIR/$b.out
|
2015-05-15 19:01:17 +00:00
|
|
|
diff -b $BASEDIR/$b.out $TARGETDIR/$b.out || HASERROR=1
|
2014-04-14 15:46:40 +00:00
|
|
|
done < localtestlist
|
|
|
|
fi
|
|
|
|
|
2015-06-26 06:12:31 +00:00
|
|
|
rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
|
2015-05-15 18:44:16 +00:00
|
|
|
|
2016-07-19 20:32:52 +00:00
|
|
|
#
|
|
|
|
# special tests
|
|
|
|
#
|
|
|
|
|
|
|
|
$EXE badMacroArgs.frag > $TARGETDIR/badMacroArgs.frag.out
|
|
|
|
diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASERROR=1
|
|
|
|
|
2013-11-07 01:06:34 +00:00
|
|
|
#
|
|
|
|
# reflection tests
|
|
|
|
#
|
|
|
|
echo Running reflection...
|
2016-07-09 20:50:57 +00:00
|
|
|
$EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out
|
2015-05-15 19:01:17 +00:00
|
|
|
diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1
|
2016-09-20 05:12:48 +00:00
|
|
|
$EXE -D -e flizv -l -q -C -V hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out
|
|
|
|
diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1
|
2016-09-21 20:19:40 +00:00
|
|
|
$EXE -D -e main -l -q -C -V hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out
|
|
|
|
diff -b $BASEDIR/hlsl.reflection.binding.frag.out $TARGETDIR/hlsl.reflection.binding.frag.out || HASERROR=1
|
2017-04-18 18:18:01 +00:00
|
|
|
$EXE -D -e main -l -q --hlsl-iomap --auto-map-bindings --stb 10 --sbb 20 --ssb 30 --suavb 40 --scb 50 -D -V -e main hlsl.automap.frag > $TARGETDIR/hlsl.automap.frag.out
|
|
|
|
diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASERROR=1
|
2013-11-07 01:06:34 +00:00
|
|
|
|
2013-09-06 19:52:57 +00:00
|
|
|
#
|
|
|
|
# multi-threaded test
|
|
|
|
#
|
|
|
|
echo Comparing single thread to multithread for all tests in current directory...
|
2016-07-09 20:50:57 +00:00
|
|
|
$EXE -i -C *.vert *.geom *.frag *.tes* *.comp > singleThread.out
|
|
|
|
$EXE -i -C *.vert *.geom *.frag *.tes* *.comp -t > multiThread.out
|
2015-05-15 19:01:17 +00:00
|
|
|
diff singleThread.out multiThread.out || HASERROR=1
|
2017-07-06 17:58:12 +00:00
|
|
|
if [ $HASERROR -eq 0 ]
|
|
|
|
then
|
|
|
|
rm singleThread.out
|
|
|
|
rm multiThread.out
|
|
|
|
fi
|
2015-05-15 19:01:17 +00:00
|
|
|
|
2016-10-31 21:13:43 +00:00
|
|
|
#
|
|
|
|
# entry point renaming tests
|
|
|
|
#
|
2016-12-10 02:22:20 +00:00
|
|
|
echo Running entry-point renaming tests
|
|
|
|
$EXE -i -H -V -D -e main_in_spv --ku --source-entrypoint main hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out
|
2016-10-31 21:13:43 +00:00
|
|
|
diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1
|
|
|
|
|
2016-12-10 02:22:20 +00:00
|
|
|
#
|
|
|
|
# Testing ill-defined uncalled function
|
|
|
|
#
|
|
|
|
echo Running ill-defined uncalled function
|
|
|
|
$EXE -D -e main -H hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out
|
|
|
|
diff -b $BASEDIR/hlsl.deadFunctionMissingBody.vert.out $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out || HASERROR=1
|
|
|
|
|
2015-05-15 21:54:24 +00:00
|
|
|
if [ $HASERROR -eq 0 ]
|
|
|
|
then
|
|
|
|
echo Tests Succeeded.
|
|
|
|
else
|
|
|
|
echo Tests Failed.
|
|
|
|
fi
|
|
|
|
|
2017-03-16 17:20:38 +00:00
|
|
|
#
|
|
|
|
# Testing -S
|
|
|
|
#
|
|
|
|
echo Running explicit stage test
|
|
|
|
$EXE -i -S vert nosuffix > $TARGETDIR/nosuffix.out
|
|
|
|
diff -b $BASEDIR/nosuffix.out $TARGETDIR/nosuffix.out || HASERROR=1
|
|
|
|
|
2017-04-05 23:38:20 +00:00
|
|
|
#
|
|
|
|
# Testing --hlsl-offsets
|
|
|
|
#
|
|
|
|
echo Running hlsl offsets
|
|
|
|
$EXE -i --hlsl-offsets -H spv.hlslOffsets.vert > $TARGETDIR/spv.hlslOffsets.vert.out
|
|
|
|
diff -b $BASEDIR/spv.hlslOffsets.vert.out $TARGETDIR/spv.hlslOffsets.vert.out || HASERROR=1
|
|
|
|
|
|
|
|
echo Running hlsl offsets
|
|
|
|
$EXE -i --hlsl-offsets -D -e main -H hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out
|
|
|
|
diff -b $BASEDIR/hlsl.hlslOffset.vert.out $TARGETDIR/hlsl.hlslOffset.vert.out || HASERROR=1
|
|
|
|
|
2017-05-02 07:27:29 +00:00
|
|
|
#
|
2017-05-18 00:28:19 +00:00
|
|
|
# Testing --resource-set-binding
|
2017-05-02 07:27:29 +00:00
|
|
|
#
|
|
|
|
echo Configuring HLSL descriptor set and binding number manually
|
|
|
|
$EXE -V -D -e main -H hlsl.multiDescriptorSet.frag --rsb frag t0 0 0 t1 1 0 s0 0 1 s1 1 1 b0 2 0 b1 2 1 b2 2 2 > $TARGETDIR/hlsl.multiDescriptorSet.frag.out
|
2017-05-31 23:11:16 +00:00
|
|
|
diff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescriptorSet.frag.out || HASERROR=1
|
2017-05-02 07:27:29 +00:00
|
|
|
|
2017-07-14 21:15:47 +00:00
|
|
|
$EXE -V -D -e main -H hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out
|
|
|
|
diff -b $BASEDIR/hlsl.explicitDescriptorSet.frag.out $TARGETDIR/hlsl.explicitDescriptorSet.frag.out || HASERROR=1
|
|
|
|
|
|
|
|
$EXE -V -D -e main -H hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out
|
|
|
|
diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1
|
|
|
|
|
2017-05-18 00:28:19 +00:00
|
|
|
#
|
|
|
|
# Testing location error
|
|
|
|
#
|
|
|
|
echo Testing SPV no location
|
|
|
|
$EXE -V -C spv.noLocation.vert > $TARGETDIR/spv.noLocation.vert.out
|
2017-05-31 23:11:16 +00:00
|
|
|
diff -b $BASEDIR/spv.noLocation.vert.out $TARGETDIR/spv.noLocation.vert.out || HASERROR=1
|
2017-08-26 21:47:25 +00:00
|
|
|
$EXE -G -H --aml spv.noBuiltInLoc.vert > $TARGETDIR/spv.noBuiltInLoc.vert.out
|
2017-07-14 11:52:31 +00:00
|
|
|
diff -b $BASEDIR/spv.noBuiltInLoc.vert.out $TARGETDIR/spv.noBuiltInLoc.vert.out || HASERROR=1
|
2017-08-26 21:47:25 +00:00
|
|
|
$EXE -G spv.looseUniformNoLoc.vert > $TARGETDIR/spv.looseUniformNoLoc.vert.out
|
|
|
|
diff -b $BASEDIR/spv.looseUniformNoLoc.vert.out $TARGETDIR/spv.looseUniformNoLoc.vert.out || HASERROR=1
|
2017-05-31 23:11:16 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Testing debug information
|
|
|
|
#
|
|
|
|
echo Testing SPV Debug Information
|
2017-07-21 02:00:36 +00:00
|
|
|
$EXE -g --relaxed-errors --suppress-warnings --aml --hlsl-offsets --nsf \
|
|
|
|
-G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.frag.out
|
2017-05-31 23:11:16 +00:00
|
|
|
diff -b $BASEDIR/spv.debugInfo.frag.out $TARGETDIR/spv.debugInfo.frag.out || HASERROR=1
|
2017-07-21 02:00:36 +00:00
|
|
|
$EXE -g -D -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \
|
|
|
|
--sep origMain -H spv.hlslDebugInfo.vert --rsb vert t0 0 0 > $TARGETDIR/spv.hlslDebugInfo.frag.out
|
|
|
|
diff -b $BASEDIR/spv.hlslDebugInfo.frag.out $TARGETDIR/spv.hlslDebugInfo.frag.out || HASERROR=1
|
2017-05-18 00:28:19 +00:00
|
|
|
|
2017-05-22 21:00:42 +00:00
|
|
|
#
|
|
|
|
# Testing Includer
|
|
|
|
#
|
|
|
|
echo Testing Includer
|
|
|
|
$EXE -D -e main -H ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out
|
|
|
|
diff -b $BASEDIR/hlsl.include.vert.out $TARGETDIR/hlsl.include.vert.out || HASERROR=1
|
|
|
|
$EXE -D -e main -H hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out
|
|
|
|
diff -b $BASEDIR/hlsl.includeNegative.vert.out $TARGETDIR/hlsl.includeNegative.vert.out || HASERROR=1
|
|
|
|
$EXE -l -i include.vert > $TARGETDIR/include.vert.out
|
|
|
|
diff -b $BASEDIR/include.vert.out $TARGETDIR/include.vert.out || HASERROR=1
|
2017-06-07 21:06:58 +00:00
|
|
|
$EXE -D -e main -H -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out
|
|
|
|
diff -b $BASEDIR/hlsl.dashI.vert.out $TARGETDIR/hlsl.dashI.vert.out || HASERROR=1
|
2017-05-22 21:00:42 +00:00
|
|
|
|
2017-06-15 16:40:49 +00:00
|
|
|
#
|
|
|
|
# Testing -D and -U
|
|
|
|
#
|
|
|
|
$EXE -DUNDEFED -UIN_SHADER -DFOO=200 -i -l -UUNDEFED -DMUL=FOO*2 glsl.-D-U.frag > $TARGETDIR/glsl.-D-U.frag.out
|
|
|
|
diff -b $BASEDIR/glsl.-D-U.frag.out $TARGETDIR/glsl.-D-U.frag.out || HASERROR=1
|
|
|
|
$EXE -D -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out
|
|
|
|
diff -b $BASEDIR/hlsl.-D-U.frag.out $TARGETDIR/hlsl.-D-U.frag.out || HASERROR=1
|
|
|
|
|
2017-06-23 17:11:09 +00:00
|
|
|
#
|
|
|
|
# Test --client and --target-env
|
|
|
|
#
|
|
|
|
$EXE --client vulkan100 spv.targetVulkan.vert || HASERROR=1
|
|
|
|
$EXE --client opengl100 spv.targetOpenGL.vert || HASERROR=1
|
|
|
|
$EXE --target-env vulkan1.0 spv.targetVulkan.vert || HASERROR=1
|
|
|
|
$EXE --target-env opengl spv.targetOpenGL.vert || HASERROR=1
|
|
|
|
$EXE -V100 spv.targetVulkan.vert || HASERROR=1
|
|
|
|
$EXE -G100 spv.targetOpenGL.vert || HASERROR=1
|
|
|
|
|
2017-09-12 03:48:19 +00:00
|
|
|
#
|
|
|
|
# Testing GLSL entry point rename
|
|
|
|
#
|
|
|
|
$EXE -H -e foo --source-entrypoint main glsl.entryPointRename.vert > $TARGETDIR/glsl.entryPointRename.vert.out
|
|
|
|
diff -b $BASEDIR/glsl.entryPointRename.vert.out $TARGETDIR/glsl.entryPointRename.vert.out || HASERROR=1
|
|
|
|
$EXE -H -e foo --source-entrypoint bar glsl.entryPointRename.vert > $TARGETDIR/glsl.entryPointRename.vert.bad.out
|
|
|
|
diff -b $BASEDIR/glsl.entryPointRename.vert.bad.out $TARGETDIR/glsl.entryPointRename.vert.bad.out || HASERROR=1
|
|
|
|
$EXE -H -e foo --source-entrypoint main glsl.entryPointRename2.vert > $TARGETDIR/glsl.entryPointRename2.vert.out
|
|
|
|
diff -b $BASEDIR/glsl.entryPointRename2.vert.out $TARGETDIR/glsl.entryPointRename2.vert.out || HASERROR=1
|
|
|
|
|
2017-04-05 23:38:20 +00:00
|
|
|
#
|
|
|
|
# Final checking
|
|
|
|
#
|
2017-03-16 17:20:38 +00:00
|
|
|
if [ $HASERROR -eq 0 ]
|
|
|
|
then
|
|
|
|
echo Tests Succeeded.
|
|
|
|
else
|
|
|
|
echo Tests Failed.
|
|
|
|
fi
|
|
|
|
|
2017-07-06 17:58:12 +00:00
|
|
|
rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
|
|
|
|
|
2015-05-15 19:01:17 +00:00
|
|
|
exit $HASERROR
|