From 99bd8a338adaefff49e2ca49378e87594f60d6c7 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 3 Jan 2023 10:01:41 +0800 Subject: [PATCH] Remove bundled shaderc --- .gitignore | 1 + CMakeLists.txt | 37 +- cmake/Toolchain-ios-xcode.cmake | 2 + .../src/ge_vulkan_shader_manager.cpp | 8 + .../src/ge_vulkan_shader_manager.hpp | 6 +- lib/shaderc/.clang-format | 5 - lib/shaderc/AUTHORS | 9 - lib/shaderc/Android.mk | 76 - lib/shaderc/BUILD.gn | 101 - lib/shaderc/CHANGES | 304 - lib/shaderc/CMakeLists.txt | 165 - lib/shaderc/CONTRIBUTING.md | 25 - lib/shaderc/CONTRIBUTORS | 24 - lib/shaderc/DEPS | 33 - lib/shaderc/DEVELOPMENT.howto.md | 52 - lib/shaderc/Dockerfile | 50 - lib/shaderc/LICENSE | 201 - lib/shaderc/README.md | 262 - lib/shaderc/cmake/linux-mingw-toolchain.cmake | 39 - lib/shaderc/cmake/setup_build.cmake | 141 - lib/shaderc/cmake/shaderc.pc.in | 12 - lib/shaderc/cmake/shaderc_combined.pc.in | 12 - lib/shaderc/cmake/shaderc_static.pc.in | 12 - lib/shaderc/cmake/utils.cmake | 229 - lib/shaderc/cmake/write_pkg_config.cmake | 31 - lib/shaderc/downloads.md | 17 - lib/shaderc/libshaderc/Android.mk | 29 - lib/shaderc/libshaderc/CMakeLists.txt | 131 - lib/shaderc/libshaderc/README.md | 52 - lib/shaderc/libshaderc/include/shaderc/env.h | 72 - .../libshaderc/include/shaderc/shaderc.h | 585 - .../libshaderc/include/shaderc/shaderc.hpp | 602 - .../libshaderc/include/shaderc/status.h | 39 - .../libshaderc/include/shaderc/visibility.h | 37 - .../libshaderc/src/common_shaders_for_test.h | 413 - lib/shaderc/libshaderc/src/shaderc.cc | 794 - .../libshaderc/src/shaderc_c_smoke_test.c | 54 - .../libshaderc/src/shaderc_cpp_test.cc | 1463 -- lib/shaderc/libshaderc/src/shaderc_private.h | 139 - .../libshaderc/src/shaderc_private_test.cc | 50 - lib/shaderc/libshaderc/src/shaderc_test.cc | 1878 --- lib/shaderc/libshaderc_util/Android.mk | 32 - lib/shaderc/libshaderc_util/CMakeLists.txt | 89 - .../include/libshaderc_util/args.h | 41 - .../include/libshaderc_util/compiler.h | 621 - .../libshaderc_util/counting_includer.h | 101 - .../include/libshaderc_util/exceptions.h | 26 - .../include/libshaderc_util/file_finder.h | 57 - .../include/libshaderc_util/format.h | 36 - .../include/libshaderc_util/io_shaderc.h | 69 - .../include/libshaderc_util/message.h | 86 - .../include/libshaderc_util/mutex.h | 107 - .../include/libshaderc_util/resources.h | 30 - .../include/libshaderc_util/resources.inc | 107 - .../include/libshaderc_util/shader_stage.h | 36 - .../libshaderc_util/spirv_tools_wrapper.h | 67 - .../include/libshaderc_util/string_piece.h | 357 - .../libshaderc_util/universal_unistd.h | 32 - .../include/libshaderc_util/version_profile.h | 61 - lib/shaderc/libshaderc_util/src/args.cc | 62 - lib/shaderc/libshaderc_util/src/compiler.cc | 785 - .../libshaderc_util/src/compiler_test.cc | 950 -- .../src/counting_includer_test.cc | 93 - lib/shaderc/libshaderc_util/src/death_test.h | 25 - .../libshaderc_util/src/file_finder.cc | 71 - .../libshaderc_util/src/file_finder_test.cc | 146 - .../libshaderc_util/src/format_test.cc | 105 - lib/shaderc/libshaderc_util/src/io_shaderc.cc | 146 - .../libshaderc_util/src/io_shaderc_test.cc | 139 - lib/shaderc/libshaderc_util/src/message.cc | 293 - .../libshaderc_util/src/message_test.cc | 281 - lib/shaderc/libshaderc_util/src/mutex_test.cc | 51 - lib/shaderc/libshaderc_util/src/resources.cc | 144 - .../libshaderc_util/src/shader_stage.cc | 53 - .../src/spirv_tools_wrapper.cc | 169 - .../libshaderc_util/src/string_piece_test.cc | 437 - .../libshaderc_util/src/version_profile.cc | 59 - .../src/version_profile_test.cc | 133 - .../testdata/copy-to-build.cmake | 16 - .../testdata/dir/subdir/include_file.2 | 0 .../libshaderc_util/testdata/include_file.1 | 1 - lib/shaderc/license-checker.cfg | 36 - lib/shaderc/third_party/Android.mk | 35 - lib/shaderc/third_party/CMakeLists.txt | 100 - lib/shaderc/third_party/LICENSE.glslang | 172 - lib/shaderc/third_party/LICENSE.spirv-tools | 211 - lib/shaderc/third_party/glslang/.appveyor.yml | 108 - lib/shaderc/third_party/glslang/.clang-format | 13 - .../third_party/glslang/.gitattributes | 17 - .../workflows/continuous_deployment.yml | 168 - .../workflows/continuous_integration.yml | 157 - .../glslang/.github/workflows/deploy.js | 73 - lib/shaderc/third_party/glslang/.gn | 39 - lib/shaderc/third_party/glslang/Android.mk | 166 - lib/shaderc/third_party/glslang/BUILD.bazel | 309 - lib/shaderc/third_party/glslang/BUILD.gn | 353 - lib/shaderc/third_party/glslang/CHANGES.md | 96 - .../third_party/glslang/CMakeLists.txt | 365 - .../third_party/glslang/CODE_OF_CONDUCT.md | 1 - .../third_party/glslang/ChooseMSVCCRT.cmake | 138 - lib/shaderc/third_party/glslang/DEPS | 82 - .../glslang/External/CMakeLists.txt | 77 - lib/shaderc/third_party/glslang/LICENSE.txt | 1016 -- .../glslang/OGLCompilersDLL/CMakeLists.txt | 48 - .../glslang/OGLCompilersDLL/InitializeDll.cpp | 165 - .../glslang/OGLCompilersDLL/InitializeDll.h | 49 - .../glslang/README-spirv-remap.txt | 137 - lib/shaderc/third_party/glslang/README.md | 479 - .../SPIRV/CInterface/spirv_c_interface.cpp | 110 - .../third_party/glslang/SPIRV/CMakeLists.txt | 138 - .../third_party/glslang/SPIRV/GLSL.ext.AMD.h | 108 - .../third_party/glslang/SPIRV/GLSL.ext.EXT.h | 43 - .../third_party/glslang/SPIRV/GLSL.ext.KHR.h | 56 - .../third_party/glslang/SPIRV/GLSL.ext.NV.h | 84 - .../third_party/glslang/SPIRV/GLSL.std.450.h | 131 - .../glslang/SPIRV/GlslangToSpv.cpp | 9453 ----------- .../third_party/glslang/SPIRV/GlslangToSpv.h | 61 - .../glslang/SPIRV/InReadableOrder.cpp | 131 - .../third_party/glslang/SPIRV/Logger.cpp | 72 - .../third_party/glslang/SPIRV/Logger.h | 83 - .../glslang/SPIRV/NonSemanticDebugPrintf.h | 50 - .../third_party/glslang/SPIRV/SPVRemapper.cpp | 1507 -- .../third_party/glslang/SPIRV/SPVRemapper.h | 304 - .../third_party/glslang/SPIRV/SpvBuilder.cpp | 3332 ---- .../third_party/glslang/SPIRV/SpvBuilder.h | 865 - .../glslang/SPIRV/SpvPostProcess.cpp | 495 - .../third_party/glslang/SPIRV/SpvTools.cpp | 246 - .../third_party/glslang/SPIRV/SpvTools.h | 93 - .../third_party/glslang/SPIRV/bitutils.h | 81 - .../third_party/glslang/SPIRV/disassemble.cpp | 761 - .../third_party/glslang/SPIRV/disassemble.h | 53 - lib/shaderc/third_party/glslang/SPIRV/doc.cpp | 3008 ---- lib/shaderc/third_party/glslang/SPIRV/doc.h | 259 - .../third_party/glslang/SPIRV/hex_float.h | 1078 -- .../third_party/glslang/SPIRV/spirv.hpp | 2509 --- lib/shaderc/third_party/glslang/SPIRV/spvIR.h | 504 - .../glslang/StandAlone/CMakeLists.txt | 127 - .../glslang/StandAlone/DirStackFileIncluder.h | 149 - .../glslang/StandAlone/ResourceLimits.cpp | 496 - .../glslang/StandAlone/ResourceLimits.h | 57 - .../glslang/StandAlone/StandAlone.cpp | 2034 --- .../third_party/glslang/StandAlone/Worklist.h | 95 - .../glslang/StandAlone/resource_limits_c.cpp | 65 - .../glslang/StandAlone/resource_limits_c.h | 54 - .../glslang/StandAlone/spirv-remap.cpp | 341 - lib/shaderc/third_party/glslang/WORKSPACE | 27 - lib/shaderc/third_party/glslang/_config.yml | 1 - .../third_party/glslang/build_info.h.tmpl | 62 - lib/shaderc/third_party/glslang/build_info.py | 226 - .../glslang/build_overrides/build.gni | 39 - .../glslang/build_overrides/glslang.gni | 37 - .../glslang/build_overrides/spirv_tools.gni | 38 - .../glslang/gen_extension_headers.py | 98 - .../CInterface/glslang_c_interface.cpp | 467 - .../glslang/glslang/CMakeLists.txt | 228 - .../GL_EXT_shader_realtime_clock.glsl | 38 - .../glslang/GenericCodeGen/CodeGen.cpp | 76 - .../glslang/glslang/GenericCodeGen/Link.cpp | 91 - .../glslang/glslang/HLSL/hlslAttributes.cpp | 149 - .../glslang/glslang/HLSL/hlslAttributes.h | 59 - .../glslang/glslang/HLSL/hlslGrammar.cpp | 4192 ----- .../glslang/glslang/HLSL/hlslGrammar.h | 142 - .../glslang/glslang/HLSL/hlslOpMap.cpp | 173 - .../glslang/glslang/HLSL/hlslOpMap.h | 69 - .../glslang/glslang/HLSL/hlslParseHelper.cpp | 10242 ------------ .../glslang/glslang/HLSL/hlslParseHelper.h | 515 - .../glslang/glslang/HLSL/hlslParseables.cpp | 1259 -- .../glslang/glslang/HLSL/hlslParseables.h | 64 - .../glslang/glslang/HLSL/hlslScanContext.cpp | 903 - .../glslang/glslang/HLSL/hlslScanContext.h | 109 - .../glslang/glslang/HLSL/hlslTokenStream.cpp | 150 - .../glslang/glslang/HLSL/hlslTokenStream.h | 96 - .../glslang/glslang/HLSL/hlslTokens.h | 374 - .../third_party/glslang/glslang/HLSL/pch.h | 53 - .../glslang/glslang/Include/BaseTypes.h | 589 - .../glslang/glslang/Include/Common.h | 348 - .../glslang/glslang/Include/ConstantUnion.h | 974 -- .../glslang/glslang/Include/InfoSink.h | 144 - .../glslang/Include/InitializeGlobals.h | 44 - .../glslang/glslang/Include/PoolAlloc.h | 318 - .../glslang/glslang/Include/ResourceLimits.h | 150 - .../glslang/glslang/Include/ShHandle.h | 176 - .../glslang/glslang/Include/SpirvIntrinsics.h | 128 - .../glslang/glslang/Include/Types.h | 2721 --- .../glslang/glslang/Include/arrays.h | 341 - .../glslang/Include/glslang_c_interface.h | 253 - .../glslang/Include/glslang_c_shader_types.h | 208 - .../glslang/glslang/Include/intermediate.h | 1845 -- .../glslang/MachineIndependent/Constant.cpp | 1398 -- .../glslang/MachineIndependent/InfoSink.cpp | 113 - .../glslang/MachineIndependent/Initialize.cpp | 9785 ----------- .../glslang/MachineIndependent/Initialize.h | 112 - .../MachineIndependent/IntermTraverse.cpp | 309 - .../MachineIndependent/Intermediate.cpp | 4027 ----- .../MachineIndependent/LiveTraverser.h | 168 - .../MachineIndependent/ParseContextBase.cpp | 735 - .../MachineIndependent/ParseHelper.cpp | 9320 ----------- .../glslang/MachineIndependent/ParseHelper.h | 588 - .../glslang/MachineIndependent/PoolAlloc.cpp | 315 - .../glslang/MachineIndependent/RemoveTree.cpp | 118 - .../glslang/MachineIndependent/RemoveTree.h | 41 - .../glslang/MachineIndependent/Scan.cpp | 1952 --- .../glslang/glslang/MachineIndependent/Scan.h | 276 - .../glslang/MachineIndependent/ScanContext.h | 93 - .../glslang/MachineIndependent/ShaderLang.cpp | 2241 --- .../MachineIndependent/SpirvIntrinsics.cpp | 350 - .../MachineIndependent/SymbolTable.cpp | 477 - .../glslang/MachineIndependent/SymbolTable.h | 955 -- .../glslang/MachineIndependent/Versions.cpp | 1346 -- .../glslang/MachineIndependent/Versions.h | 347 - .../glslang/MachineIndependent/attribute.cpp | 371 - .../glslang/MachineIndependent/attribute.h | 150 - .../glslang/MachineIndependent/gl_types.h | 218 - .../glslang/MachineIndependent/glslang.m4 | 4397 ----- .../glslang/MachineIndependent/glslang.y | 4397 ----- .../MachineIndependent/glslang_tab.cpp | 12434 -------------- .../MachineIndependent/glslang_tab.cpp.h | 568 - .../glslang/MachineIndependent/intermOut.cpp | 1561 -- .../glslang/MachineIndependent/iomapper.cpp | 1713 -- .../glslang/MachineIndependent/iomapper.h | 352 - .../glslang/MachineIndependent/limits.cpp | 200 - .../MachineIndependent/linkValidate.cpp | 2188 --- .../MachineIndependent/localintermediate.h | 1193 -- .../glslang/MachineIndependent/parseConst.cpp | 213 - .../MachineIndependent/parseVersions.h | 245 - .../glslang/glslang/MachineIndependent/pch.h | 49 - .../MachineIndependent/preprocessor/Pp.cpp | 1346 -- .../preprocessor/PpAtom.cpp | 181 - .../preprocessor/PpContext.cpp | 120 - .../preprocessor/PpContext.h | 703 - .../preprocessor/PpScanner.cpp | 1317 -- .../preprocessor/PpTokens.cpp | 221 - .../preprocessor/PpTokens.h | 179 - .../propagateNoContraction.cpp | 870 - .../propagateNoContraction.h | 55 - .../glslang/MachineIndependent/reflection.cpp | 1274 -- .../glslang/MachineIndependent/reflection.h | 223 - .../glslang/OSDependent/Unix/CMakeLists.txt | 59 - .../glslang/OSDependent/Unix/ossource.cpp | 213 - .../glslang/OSDependent/Web/CMakeLists.txt | 71 - .../glslang/OSDependent/Web/glslang.after.js | 26 - .../glslang/OSDependent/Web/glslang.js.cpp | 287 - .../glslang/OSDependent/Web/glslang.pre.js | 56 - .../OSDependent/Windows/CMakeLists.txt | 54 - .../glslang/OSDependent/Windows/main.cpp | 74 - .../glslang/OSDependent/Windows/ossource.cpp | 147 - .../glslang/glslang/OSDependent/osinclude.h | 63 - .../glslang/glslang/Public/ShaderLang.h | 976 -- .../third_party/glslang/glslang/updateGrammar | 49 - .../third_party/glslang/hlsl/CMakeLists.txt | 59 - lib/shaderc/third_party/glslang/hlsl/stub.cpp | 41 - .../third_party/glslang/known_good.json | 18 - .../third_party/glslang/known_good_khr.json | 18 - .../third_party/glslang/license-checker.cfg | 59 - .../third_party/glslang/parse_version.cmake | 41 - .../third_party/glslang/standalone.gclient | 42 - .../glslang/update_glslang_sources.py | 155 - lib/shaderc/third_party/re2/.github/bazel.sh | 24 - lib/shaderc/third_party/re2/.github/cmake.sh | 12 - .../re2/.github/workflows/ci-bazel.yml | 17 - .../re2/.github/workflows/ci-cmake.yml | 15 - .../third_party/re2/.github/workflows/ci.yml | 51 - lib/shaderc/third_party/re2/AUTHORS | 13 - lib/shaderc/third_party/re2/BUILD | 280 - lib/shaderc/third_party/re2/CMakeLists.txt | 158 - lib/shaderc/third_party/re2/CONTRIBUTING.md | 2 - lib/shaderc/third_party/re2/CONTRIBUTORS | 41 - lib/shaderc/third_party/re2/LICENSE | 27 - lib/shaderc/third_party/re2/Makefile | 379 - lib/shaderc/third_party/re2/README | 41 - lib/shaderc/third_party/re2/WORKSPACE | 15 - .../third_party/re2/benchlog/benchlog.c2 | 2211 --- .../third_party/re2/benchlog/benchlog.mini | 582 - .../third_party/re2/benchlog/benchlog.r70 | 1475 -- .../third_party/re2/benchlog/benchlog.wreck | 1058 -- .../third_party/re2/benchlog/benchplot.py | 98 - lib/shaderc/third_party/re2/benchlog/mktable | 155 - .../third_party/re2/lib/git/commit-msg.hook | 104 - lib/shaderc/third_party/re2/libre2.symbols | 19 - .../third_party/re2/libre2.symbols.darwin | 15 - lib/shaderc/third_party/re2/re2.pc | 8 - lib/shaderc/third_party/re2/re2/bitmap256.h | 117 - lib/shaderc/third_party/re2/re2/bitstate.cc | 385 - lib/shaderc/third_party/re2/re2/compile.cc | 1245 -- lib/shaderc/third_party/re2/re2/dfa.cc | 2115 --- .../third_party/re2/re2/filtered_re2.cc | 137 - .../third_party/re2/re2/filtered_re2.h | 114 - .../re2/re2/fuzzing/compiler-rt/LICENSE | 219 - .../include/fuzzer/FuzzedDataProvider.h | 305 - .../third_party/re2/re2/fuzzing/re2_fuzzer.cc | 171 - .../third_party/re2/re2/make_perl_groups.pl | 116 - .../re2/re2/make_unicode_casefold.py | 151 - .../re2/re2/make_unicode_groups.py | 117 - .../third_party/re2/re2/mimics_pcre.cc | 197 - lib/shaderc/third_party/re2/re2/nfa.cc | 713 - lib/shaderc/third_party/re2/re2/onepass.cc | 623 - lib/shaderc/third_party/re2/re2/parse.cc | 2464 --- .../third_party/re2/re2/perl_groups.cc | 119 - lib/shaderc/third_party/re2/re2/pod_array.h | 55 - lib/shaderc/third_party/re2/re2/prefilter.cc | 711 - lib/shaderc/third_party/re2/re2/prefilter.h | 108 - .../third_party/re2/re2/prefilter_tree.cc | 407 - .../third_party/re2/re2/prefilter_tree.h | 139 - lib/shaderc/third_party/re2/re2/prog.cc | 988 -- lib/shaderc/third_party/re2/re2/prog.h | 436 - lib/shaderc/third_party/re2/re2/re2.cc | 1331 -- lib/shaderc/third_party/re2/re2/re2.h | 1014 -- lib/shaderc/third_party/re2/re2/regexp.cc | 987 -- lib/shaderc/third_party/re2/re2/regexp.h | 661 - lib/shaderc/third_party/re2/re2/set.cc | 173 - lib/shaderc/third_party/re2/re2/set.h | 85 - lib/shaderc/third_party/re2/re2/simplify.cc | 665 - .../third_party/re2/re2/sparse_array.h | 392 - lib/shaderc/third_party/re2/re2/sparse_set.h | 264 - .../third_party/re2/re2/stringpiece.cc | 65 - lib/shaderc/third_party/re2/re2/stringpiece.h | 210 - lib/shaderc/third_party/re2/re2/tostring.cc | 351 - lib/shaderc/third_party/re2/re2/unicode.py | 303 - .../third_party/re2/re2/unicode_casefold.cc | 582 - .../third_party/re2/re2/unicode_casefold.h | 78 - .../third_party/re2/re2/unicode_groups.cc | 6269 ------- .../third_party/re2/re2/unicode_groups.h | 67 - lib/shaderc/third_party/re2/re2/walker-inl.h | 246 - lib/shaderc/third_party/re2/runtests | 33 - lib/shaderc/third_party/re2/testinstall.cc | 27 - lib/shaderc/third_party/re2/ucs2.diff | 567 - lib/shaderc/third_party/re2/util/benchmark.cc | 131 - lib/shaderc/third_party/re2/util/benchmark.h | 156 - lib/shaderc/third_party/re2/util/flags.h | 26 - lib/shaderc/third_party/re2/util/fuzz.cc | 21 - lib/shaderc/third_party/re2/util/logging.h | 109 - .../third_party/re2/util/malloc_counter.h | 19 - lib/shaderc/third_party/re2/util/mix.h | 41 - lib/shaderc/third_party/re2/util/mutex.h | 148 - lib/shaderc/third_party/re2/util/pcre.cc | 1025 -- lib/shaderc/third_party/re2/util/pcre.h | 681 - lib/shaderc/third_party/re2/util/rune.cc | 260 - lib/shaderc/third_party/re2/util/strutil.cc | 149 - lib/shaderc/third_party/re2/util/strutil.h | 21 - lib/shaderc/third_party/re2/util/test.cc | 34 - lib/shaderc/third_party/re2/util/test.h | 50 - lib/shaderc/third_party/re2/util/utf.h | 44 - lib/shaderc/third_party/re2/util/util.h | 42 - .../third_party/spirv-headers/.gitattributes | 7 - .../.github/workflows/presubmit.yml | 37 - .../third_party/spirv-headers/BUILD.bazel | 171 - .../third_party/spirv-headers/BUILD.gn | 44 - .../third_party/spirv-headers/CMakeLists.txt | 133 - .../spirv-headers/CODE_OF_CONDUCT.md | 1 - lib/shaderc/third_party/spirv-headers/LICENSE | 25 - .../third_party/spirv-headers/README.md | 226 - .../spirv-headers/SPIRV-Headers.pc.in | 9 - .../third_party/spirv-headers/WORKSPACE | 0 .../spirv-headers/cmake/Config.cmake.in | 4 - .../spirv-headers/example/CMakeLists.txt | 4 - .../spirv-headers/example/example.cpp | 37 - .../include/spirv/1.0/GLSL.std.450.h | 131 - .../include/spirv/1.0/OpenCL.std.h | 210 - .../1.0/extinst.glsl.std.450.grammar.json | 642 - .../1.0/extinst.opencl.std.100.grammar.json | 1279 -- .../include/spirv/1.0/spirv.core.grammar.json | 5775 ------- .../spirv-headers/include/spirv/1.0/spirv.cs | 993 -- .../spirv-headers/include/spirv/1.0/spirv.h | 993 -- .../spirv-headers/include/spirv/1.0/spirv.hpp | 1002 -- .../include/spirv/1.0/spirv.hpp11 | 1002 -- .../include/spirv/1.0/spirv.json | 1020 -- .../spirv-headers/include/spirv/1.0/spirv.lua | 949 -- .../spirv-headers/include/spirv/1.0/spirv.py | 949 -- .../include/spirv/1.1/GLSL.std.450.h | 131 - .../include/spirv/1.1/OpenCL.std.h | 210 - .../1.1/extinst.glsl.std.450.grammar.json | 642 - .../1.1/extinst.opencl.std.100.grammar.json | 1279 -- .../include/spirv/1.1/spirv.core.grammar.json | 5938 ------- .../spirv-headers/include/spirv/1.1/spirv.cs | 1015 -- .../spirv-headers/include/spirv/1.1/spirv.h | 1015 -- .../spirv-headers/include/spirv/1.1/spirv.hpp | 1024 -- .../include/spirv/1.1/spirv.hpp11 | 1024 -- .../include/spirv/1.1/spirv.json | 1040 -- .../spirv-headers/include/spirv/1.1/spirv.lua | 971 -- .../spirv-headers/include/spirv/1.1/spirv.py | 971 -- .../include/spirv/1.2/GLSL.std.450.h | 131 - .../include/spirv/1.2/OpenCL.std.h | 210 - .../1.2/extinst.glsl.std.450.grammar.json | 642 - .../1.2/extinst.opencl.std.100.grammar.json | 1279 -- .../include/spirv/1.2/spirv.core.grammar.json | 5986 ------- .../spirv-headers/include/spirv/1.2/spirv.cs | 1021 -- .../spirv-headers/include/spirv/1.2/spirv.h | 1021 -- .../spirv-headers/include/spirv/1.2/spirv.hpp | 1030 -- .../include/spirv/1.2/spirv.hpp11 | 1030 -- .../include/spirv/1.2/spirv.json | 1046 -- .../spirv-headers/include/spirv/1.2/spirv.lua | 977 -- .../spirv-headers/include/spirv/1.2/spirv.py | 977 -- .../spirv-headers/include/spirv/spir-v.xml | 279 - .../include/spirv/unified1/AMD_gcn_shader.h | 52 - .../spirv/unified1/AMD_shader_ballot.h | 53 - .../AMD_shader_explicit_vertex_parameter.h | 50 - .../unified1/AMD_shader_trinary_minmax.h | 58 - .../include/spirv/unified1/DebugInfo.h | 144 - .../include/spirv/unified1/GLSL.std.450.h | 131 - .../unified1/NonSemanticClspvReflection.h | 74 - .../spirv/unified1/NonSemanticDebugPrintf.h | 50 - .../unified1/NonSemanticShaderDebugInfo100.h | 171 - .../include/spirv/unified1/OpenCL.std.h | 401 - .../spirv/unified1/OpenCLDebugInfo100.h | 158 - .../unified1/extinst.debuginfo.grammar.json | 572 - .../extinst.glsl.std.450.grammar.json | 642 - ...t.nonsemantic.clspvreflection.grammar.json | 244 - ...tinst.nonsemantic.debugprintf.grammar.json | 13 - ...semantic.shader.debuginfo.100.grammar.json | 713 - .../extinst.opencl.debuginfo.100.grammar.json | 651 - .../extinst.opencl.std.100.grammar.json | 1279 -- .../extinst.spv-amd-gcn-shader.grammar.json | 26 - ...extinst.spv-amd-shader-ballot.grammar.json | 41 - ...der-explicit-vertex-parameter.grammar.json | 14 - ...spv-amd-shader-trinary-minmax.grammar.json | 95 - .../spirv/unified1/spirv.core.grammar.json | 13949 ---------------- .../include/spirv/unified1/spirv.cs | 1847 -- .../include/spirv/unified1/spirv.h | 2498 --- .../include/spirv/unified1/spirv.hpp | 2509 --- .../include/spirv/unified1/spirv.hpp11 | 2509 --- .../include/spirv/unified1/spirv.json | 1838 -- .../include/spirv/unified1/spirv.lua | 1792 -- .../include/spirv/unified1/spirv.py | 1792 -- .../include/spirv/unified1/spv.d | 1849 -- .../tools/buildHeaders/CMakeLists.txt | 26 - .../bin/generate_language_headers.py | 242 - .../buildHeaders/bin/makeExtinstHeaders.py | 28 - .../tools/buildHeaders/bin/makeHeaders | 7 - .../tools/buildHeaders/header.cpp | 835 - .../spirv-headers/tools/buildHeaders/header.h | 54 - .../tools/buildHeaders/jsonToSpirv.cpp | 551 - .../tools/buildHeaders/jsonToSpirv.h | 301 - .../jsoncpp/dist/json/json-forwards.h | 255 - .../buildHeaders/jsoncpp/dist/json/json.h | 2017 --- .../buildHeaders/jsoncpp/dist/jsoncpp.cpp | 5124 ------ .../spirv-headers/tools/buildHeaders/main.cpp | 127 - .../third_party/spirv-tools/.clang-format | 6 - .../spirv-tools/.github/workflows/wasm.yml | 14 - lib/shaderc/third_party/spirv-tools/.gn | 20 - .../third_party/spirv-tools/Android.mk | 344 - .../third_party/spirv-tools/BUILD.bazel | 557 - lib/shaderc/third_party/spirv-tools/BUILD.gn | 1532 -- lib/shaderc/third_party/spirv-tools/CHANGES | 1393 -- .../third_party/spirv-tools/CMakeLists.txt | 402 - .../spirv-tools/CODE_OF_CONDUCT.md | 1 - .../third_party/spirv-tools/CONTRIBUTING.md | 185 - lib/shaderc/third_party/spirv-tools/DEPS | 26 - lib/shaderc/third_party/spirv-tools/LICENSE | 202 - .../third_party/spirv-tools/PRESUBMIT.py | 40 - lib/shaderc/third_party/spirv-tools/README.md | 757 - lib/shaderc/third_party/spirv-tools/WORKSPACE | 19 - .../spirv-tools/android_test/Android.mk | 12 - .../android_test/jni/Application.mk | 5 - .../spirv-tools/android_test/test.cpp | 22 - .../third_party/spirv-tools/build_defs.bzl | 309 - .../spirv-tools/build_overrides/build.gni | 43 - .../spirv-tools/build_overrides/gtest.gni | 25 - .../build_overrides/spirv_tools.gni | 25 - .../cmake/SPIRV-Tools-shared.pc.in | 12 - .../spirv-tools/cmake/SPIRV-Tools.pc.in | 12 - .../spirv-tools/cmake/write_pkg_config.cmake | 31 - .../spirv-tools/codereview.settings | 2 - .../spirv-tools/docker-compose.yml | 10 - .../third_party/spirv-tools/docs/downloads.md | 28 - .../third_party/spirv-tools/docs/projects.md | 82 - .../spirv-tools/docs/spirv-fuzz.md | 83 - .../third_party/spirv-tools/docs/syntax.md | 238 - .../spirv-tools/external/CMakeLists.txt | 179 - .../include/spirv-tools/instrument.hpp | 259 - .../include/spirv-tools/libspirv.h | 903 - .../include/spirv-tools/libspirv.hpp | 370 - .../include/spirv-tools/linker.hpp | 97 - .../include/spirv-tools/linter.hpp | 48 - .../include/spirv-tools/optimizer.hpp | 901 - .../spirv-tools/source/CMakeLists.txt | 441 - .../spirv-tools/source/assembly_grammar.cpp | 264 - .../spirv-tools/source/assembly_grammar.h | 138 - .../third_party/spirv-tools/source/binary.cpp | 839 - .../third_party/spirv-tools/source/binary.h | 43 - .../third_party/spirv-tools/source/cfa.h | 347 - .../spirv-tools/source/common_debug_info.h | 64 - .../spirv-tools/source/diagnostic.cpp | 193 - .../spirv-tools/source/diagnostic.h | 79 - .../spirv-tools/source/disassemble.cpp | 565 - .../spirv-tools/source/disassemble.h | 97 - .../third_party/spirv-tools/source/enum_set.h | 208 - .../source/enum_string_mapping.cpp | 29 - .../spirv-tools/source/enum_string_mapping.h | 36 - .../spirv-tools/source/ext_inst.cpp | 209 - .../third_party/spirv-tools/source/ext_inst.h | 46 - .../spirv-tools/source/extensions.cpp | 46 - .../spirv-tools/source/extensions.h | 40 - .../spirv-tools/source/fuzz/CMakeLists.txt | 487 - .../source/fuzz/added_function_reducer.cpp | 302 - .../source/fuzz/added_function_reducer.h | 193 - .../source/fuzz/available_instructions.cpp | 191 - .../source/fuzz/available_instructions.h | 111 - .../spirv-tools/source/fuzz/call_graph.cpp | 183 - .../spirv-tools/source/fuzz/call_graph.h | 110 - .../fuzz/comparator_deep_blocks_first.h | 53 - .../fuzz/counter_overflow_id_source.cpp | 36 - .../source/fuzz/counter_overflow_id_source.h | 49 - .../source/fuzz/data_descriptor.cpp | 69 - .../spirv-tools/source/fuzz/data_descriptor.h | 48 - .../source/fuzz/equivalence_relation.h | 247 - .../fact_manager/constant_uniform_facts.cpp | 235 - .../fact_manager/constant_uniform_facts.h | 90 - .../data_synonym_and_id_equation_facts.cpp | 932 -- .../data_synonym_and_id_equation_facts.h | 185 - .../fuzz/fact_manager/dead_block_facts.cpp | 45 - .../fuzz/fact_manager/dead_block_facts.h | 53 - .../source/fuzz/fact_manager/fact_manager.cpp | 279 - .../source/fuzz/fact_manager/fact_manager.h | 225 - .../fact_manager/irrelevant_value_facts.cpp | 133 - .../fact_manager/irrelevant_value_facts.h | 81 - .../fact_manager/livesafe_function_facts.cpp | 46 - .../fact_manager/livesafe_function_facts.h | 50 - .../source/fuzz/force_render_red.cpp | 370 - .../source/fuzz/force_render_red.h | 49 - .../spirv-tools/source/fuzz/fuzzer.cpp | 394 - .../spirv-tools/source/fuzz/fuzzer.h | 202 - .../source/fuzz/fuzzer_context.cpp | 438 - .../spirv-tools/source/fuzz/fuzzer_context.h | 610 - .../spirv-tools/source/fuzz/fuzzer_pass.cpp | 798 - .../spirv-tools/source/fuzz/fuzzer_pass.h | 334 - .../fuzz/fuzzer_pass_add_access_chains.cpp | 191 - .../fuzz/fuzzer_pass_add_access_chains.h | 40 - ...zzer_pass_add_bit_instruction_synonyms.cpp | 79 - ...fuzzer_pass_add_bit_instruction_synonyms.h | 40 - .../fuzzer_pass_add_composite_extract.cpp | 160 - .../fuzz/fuzzer_pass_add_composite_extract.h | 39 - .../fuzzer_pass_add_composite_inserts.cpp | 233 - .../fuzz/fuzzer_pass_add_composite_inserts.h | 45 - .../fuzz/fuzzer_pass_add_composite_types.cpp | 145 - .../fuzz/fuzzer_pass_add_composite_types.h | 60 - .../fuzz/fuzzer_pass_add_copy_memory.cpp | 81 - .../source/fuzz/fuzzer_pass_add_copy_memory.h | 39 - .../fuzz/fuzzer_pass_add_dead_blocks.cpp | 83 - .../source/fuzz/fuzzer_pass_add_dead_blocks.h | 39 - .../fuzz/fuzzer_pass_add_dead_breaks.cpp | 126 - .../source/fuzz/fuzzer_pass_add_dead_breaks.h | 38 - .../fuzz/fuzzer_pass_add_dead_continues.cpp | 93 - .../fuzz/fuzzer_pass_add_dead_continues.h | 38 - .../fuzzer_pass_add_equation_instructions.cpp | 412 - .../fuzzer_pass_add_equation_instructions.h | 79 - .../fuzz/fuzzer_pass_add_function_calls.cpp | 202 - .../fuzz/fuzzer_pass_add_function_calls.h | 49 - .../fuzz/fuzzer_pass_add_global_variables.cpp | 98 - .../fuzz/fuzzer_pass_add_global_variables.h | 39 - ...ass_add_image_sample_unused_components.cpp | 198 - ..._pass_add_image_sample_unused_components.h | 40 - .../source/fuzz/fuzzer_pass_add_loads.cpp | 139 - .../source/fuzz/fuzzer_pass_add_loads.h | 38 - .../fuzz/fuzzer_pass_add_local_variables.cpp | 83 - .../fuzz/fuzzer_pass_add_local_variables.h | 39 - .../fuzz/fuzzer_pass_add_loop_preheaders.cpp | 65 - .../fuzz/fuzzer_pass_add_loop_preheaders.h | 42 - ..._loops_to_create_int_constant_synonyms.cpp | 256 - ...dd_loops_to_create_int_constant_synonyms.h | 52 - ...er_pass_add_no_contraction_decorations.cpp | 55 - ...zzer_pass_add_no_contraction_decorations.h | 38 - .../fuzz/fuzzer_pass_add_opphi_synonyms.cpp | 311 - .../fuzz/fuzzer_pass_add_opphi_synonyms.h | 72 - .../fuzz/fuzzer_pass_add_parameters.cpp | 144 - .../source/fuzz/fuzzer_pass_add_parameters.h | 46 - .../fuzzer_pass_add_relaxed_decorations.cpp | 54 - .../fuzzer_pass_add_relaxed_decorations.h | 38 - .../source/fuzz/fuzzer_pass_add_stores.cpp | 174 - .../source/fuzz/fuzzer_pass_add_stores.h | 40 - .../source/fuzz/fuzzer_pass_add_synonyms.cpp | 134 - .../source/fuzz/fuzzer_pass_add_synonyms.h | 39 - ...r_pass_add_vector_shuffle_instructions.cpp | 143 - ...zer_pass_add_vector_shuffle_instructions.h | 38 - .../fuzzer_pass_adjust_branch_weights.cpp | 47 - .../fuzz/fuzzer_pass_adjust_branch_weights.h | 40 - .../fuzzer_pass_adjust_function_controls.cpp | 70 - .../fuzzer_pass_adjust_function_controls.h | 38 - .../fuzz/fuzzer_pass_adjust_loop_controls.cpp | 117 - .../fuzz/fuzzer_pass_adjust_loop_controls.h | 38 - ...zzer_pass_adjust_memory_operands_masks.cpp | 107 - ...fuzzer_pass_adjust_memory_operands_masks.h | 39 - .../fuzzer_pass_adjust_selection_controls.cpp | 71 - .../fuzzer_pass_adjust_selection_controls.h | 38 - .../fuzz/fuzzer_pass_apply_id_synonyms.cpp | 206 - .../fuzz/fuzzer_pass_apply_id_synonyms.h | 50 - .../fuzz/fuzzer_pass_construct_composites.cpp | 351 - .../fuzz/fuzzer_pass_construct_composites.h | 70 - .../source/fuzz/fuzzer_pass_copy_objects.cpp | 88 - .../source/fuzz/fuzzer_pass_copy_objects.h | 38 - .../fuzz/fuzzer_pass_donate_modules.cpp | 1215 -- .../source/fuzz/fuzzer_pass_donate_modules.h | 163 - ...pass_duplicate_regions_with_selections.cpp | 131 - ...r_pass_duplicate_regions_with_selections.h | 41 - .../fuzzer_pass_expand_vector_reductions.cpp | 66 - .../fuzzer_pass_expand_vector_reductions.h | 40 - ...zzer_pass_flatten_conditional_branches.cpp | 249 - ...fuzzer_pass_flatten_conditional_branches.h | 45 - .../fuzz/fuzzer_pass_inline_functions.cpp | 103 - .../fuzz/fuzzer_pass_inline_functions.h | 40 - ...rchange_signedness_of_integer_operands.cpp | 157 - ...terchange_signedness_of_integer_operands.h | 50 - ...r_pass_interchange_zero_like_constants.cpp | 114 - ...zer_pass_interchange_zero_like_constants.h | 52 - ...uzzer_pass_invert_comparison_operators.cpp | 50 - .../fuzzer_pass_invert_comparison_operators.h | 39 - ...er_pass_make_vector_operations_dynamic.cpp | 69 - ...zzer_pass_make_vector_operations_dynamic.h | 39 - .../source/fuzz/fuzzer_pass_merge_blocks.cpp | 62 - .../source/fuzz/fuzzer_pass_merge_blocks.h | 38 - .../fuzzer_pass_merge_function_returns.cpp | 337 - .../fuzz/fuzzer_pass_merge_function_returns.h | 68 - .../fuzz/fuzzer_pass_mutate_pointers.cpp | 73 - .../source/fuzz/fuzzer_pass_mutate_pointers.h | 38 - .../fuzz/fuzzer_pass_obfuscate_constants.cpp | 522 - .../fuzz/fuzzer_pass_obfuscate_constants.h | 111 - .../fuzz/fuzzer_pass_outline_functions.cpp | 195 - .../fuzz/fuzzer_pass_outline_functions.h | 64 - .../fuzz/fuzzer_pass_permute_blocks.cpp | 78 - .../source/fuzz/fuzzer_pass_permute_blocks.h | 39 - ...uzzer_pass_permute_function_parameters.cpp | 70 - .../fuzzer_pass_permute_function_parameters.h | 44 - ...fuzzer_pass_permute_function_variables.cpp | 75 - .../fuzzer_pass_permute_function_variables.h | 38 - .../fuzz/fuzzer_pass_permute_instructions.cpp | 63 - .../fuzz/fuzzer_pass_permute_instructions.h | 39 - .../fuzz/fuzzer_pass_permute_phi_operands.cpp | 64 - .../fuzz/fuzzer_pass_permute_phi_operands.h | 39 - ...uzzer_pass_propagate_instructions_down.cpp | 65 - .../fuzzer_pass_propagate_instructions_down.h | 38 - .../fuzzer_pass_propagate_instructions_up.cpp | 61 - .../fuzzer_pass_propagate_instructions_up.h | 39 - ...fuzzer_pass_push_ids_through_variables.cpp | 158 - .../fuzzer_pass_push_ids_through_variables.h | 40 - ..._adds_subs_muls_with_carrying_extended.cpp | 77 - ...ce_adds_subs_muls_with_carrying_extended.h | 41 - ...e_branches_from_dead_blocks_with_exits.cpp | 131 - ...ace_branches_from_dead_blocks_with_exits.h | 40 - ...eplace_copy_memories_with_loads_stores.cpp | 56 - ..._replace_copy_memories_with_loads_stores.h | 40 - ...replace_copy_objects_with_stores_loads.cpp | 87 - ...s_replace_copy_objects_with_stores_loads.h | 40 - .../fuzzer_pass_replace_irrelevant_ids.cpp | 182 - .../fuzz/fuzzer_pass_replace_irrelevant_ids.h | 38 - ...ss_replace_linear_algebra_instructions.cpp | 61 - ...pass_replace_linear_algebra_instructions.h | 39 - ...eplace_loads_stores_with_copy_memories.cpp | 103 - ..._replace_loads_stores_with_copy_memories.h | 40 - ...place_opphi_ids_from_dead_predecessors.cpp | 119 - ...replace_opphi_ids_from_dead_predecessors.h | 38 - ...ce_opselects_with_conditional_branches.cpp | 170 - ...lace_opselects_with_conditional_branches.h | 52 - ...zer_pass_replace_parameter_with_global.cpp | 87 - ...uzzer_pass_replace_parameter_with_global.h | 39 - ...fuzzer_pass_replace_params_with_struct.cpp | 111 - .../fuzzer_pass_replace_params_with_struct.h | 39 - .../source/fuzz/fuzzer_pass_split_blocks.cpp | 103 - .../source/fuzz/fuzzer_pass_split_blocks.h | 39 - .../fuzzer_pass_swap_commutable_operands.cpp | 50 - .../fuzzer_pass_swap_commutable_operands.h | 40 - ..._pass_swap_conditional_branch_operands.cpp | 58 - ...er_pass_swap_conditional_branch_operands.h | 39 - .../fuzz/fuzzer_pass_swap_functions.cpp | 53 - .../source/fuzz/fuzzer_pass_swap_functions.h | 38 - ...r_pass_toggle_access_chain_instruction.cpp | 53 - ...zer_pass_toggle_access_chain_instruction.h | 39 - ...fuzzer_pass_wrap_regions_in_selections.cpp | 138 - .../fuzzer_pass_wrap_regions_in_selections.h | 54 - .../fuzz/fuzzer_pass_wrap_vector_synonym.cpp | 144 - .../fuzz/fuzzer_pass_wrap_vector_synonym.h | 38 - .../spirv-tools/source/fuzz/fuzzer_util.cpp | 2110 --- .../spirv-tools/source/fuzz/fuzzer_util.h | 626 - .../source/fuzz/id_use_descriptor.cpp | 62 - .../source/fuzz/id_use_descriptor.h | 47 - .../source/fuzz/instruction_descriptor.cpp | 122 - .../source/fuzz/instruction_descriptor.h | 53 - .../source/fuzz/instruction_message.cpp | 80 - .../source/fuzz/instruction_message.h | 47 - .../source/fuzz/overflow_id_source.cpp | 23 - .../source/fuzz/overflow_id_source.h | 111 - .../pass_management/repeated_pass_instances.h | 189 - .../pass_management/repeated_pass_manager.cpp | 51 - .../pass_management/repeated_pass_manager.h | 75 - ...ss_manager_looped_with_recommendations.cpp | 70 - ...pass_manager_looped_with_recommendations.h | 69 - ...ss_manager_random_with_recommendations.cpp | 62 - ...pass_manager_random_with_recommendations.h | 68 - .../repeated_pass_manager_simple.cpp | 33 - .../repeated_pass_manager_simple.h | 39 - .../repeated_pass_recommender.cpp | 23 - .../repeated_pass_recommender.h | 42 - .../repeated_pass_recommender_standard.cpp | 383 - .../repeated_pass_recommender_standard.h | 50 - .../fuzz/protobufs/spirvfuzz_protobufs.h | 57 - .../source/fuzz/protobufs/spvtoolsfuzz.proto | 2428 --- .../source/fuzz/pseudo_random_generator.cpp | 51 - .../source/fuzz/pseudo_random_generator.h | 49 - .../source/fuzz/random_generator.cpp | 25 - .../source/fuzz/random_generator.h | 48 - .../spirv-tools/source/fuzz/replayer.cpp | 170 - .../spirv-tools/source/fuzz/replayer.h | 105 - .../spirv-tools/source/fuzz/shrinker.cpp | 316 - .../spirv-tools/source/fuzz/shrinker.h | 128 - .../source/fuzz/transformation.cpp | 411 - .../spirv-tools/source/fuzz/transformation.h | 108 - .../fuzz/transformation_access_chain.cpp | 436 - .../source/fuzz/transformation_access_chain.h | 106 - ...sformation_add_bit_instruction_synonym.cpp | 300 - ...ansformation_add_bit_instruction_synonym.h | 151 - .../transformation_add_constant_boolean.cpp | 76 - .../transformation_add_constant_boolean.h | 58 - .../transformation_add_constant_composite.cpp | 153 - .../transformation_add_constant_composite.h | 66 - .../fuzz/transformation_add_constant_null.cpp | 75 - .../fuzz/transformation_add_constant_null.h | 56 - .../transformation_add_constant_scalar.cpp | 101 - .../fuzz/transformation_add_constant_scalar.h | 61 - .../fuzz/transformation_add_copy_memory.cpp | 215 - .../fuzz/transformation_add_copy_memory.h | 78 - .../fuzz/transformation_add_dead_block.cpp | 196 - .../fuzz/transformation_add_dead_block.h | 67 - .../fuzz/transformation_add_dead_break.cpp | 208 - .../fuzz/transformation_add_dead_break.h | 80 - .../fuzz/transformation_add_dead_continue.cpp | 155 - .../fuzz/transformation_add_dead_continue.h | 77 - ...formation_add_early_terminator_wrapper.cpp | 108 - ...nsformation_add_early_terminator_wrapper.h | 63 - .../fuzz/transformation_add_function.cpp | 958 -- .../source/fuzz/transformation_add_function.h | 128 - .../fuzz/transformation_add_global_undef.cpp | 69 - .../fuzz/transformation_add_global_undef.h | 55 - .../transformation_add_global_variable.cpp | 122 - .../fuzz/transformation_add_global_variable.h | 69 - ...ion_add_image_sample_unused_components.cpp | 121 - ...ation_add_image_sample_unused_components.h | 59 - .../transformation_add_local_variable.cpp | 103 - .../fuzz/transformation_add_local_variable.h | 64 - .../transformation_add_loop_preheader.cpp | 233 - .../fuzz/transformation_add_loop_preheader.h | 59 - ...dd_loop_to_create_int_constant_synonym.cpp | 452 - ..._add_loop_to_create_int_constant_synonym.h | 71 - ...ormation_add_no_contraction_decoration.cpp | 113 - ...sformation_add_no_contraction_decoration.h | 62 - .../fuzz/transformation_add_opphi_synonym.cpp | 204 - .../fuzz/transformation_add_opphi_synonym.h | 75 - .../fuzz/transformation_add_parameter.cpp | 225 - .../fuzz/transformation_add_parameter.h | 75 - .../transformation_add_relaxed_decoration.cpp | 150 - .../transformation_add_relaxed_decoration.h | 64 - .../transformation_add_spec_constant_op.cpp | 91 - .../transformation_add_spec_constant_op.h | 62 - .../fuzz/transformation_add_synonym.cpp | 338 - .../source/fuzz/transformation_add_synonym.h | 94 - .../fuzz/transformation_add_type_array.cpp | 98 - .../fuzz/transformation_add_type_array.h | 61 - .../fuzz/transformation_add_type_boolean.cpp | 69 - .../fuzz/transformation_add_type_boolean.h | 53 - .../fuzz/transformation_add_type_float.cpp | 93 - .../fuzz/transformation_add_type_float.h | 55 - .../fuzz/transformation_add_type_function.cpp | 89 - .../fuzz/transformation_add_type_function.h | 63 - .../fuzz/transformation_add_type_int.cpp | 105 - .../source/fuzz/transformation_add_type_int.h | 56 - .../fuzz/transformation_add_type_matrix.cpp | 79 - .../fuzz/transformation_add_type_matrix.h | 57 - .../fuzz/transformation_add_type_pointer.cpp | 74 - .../fuzz/transformation_add_type_pointer.h | 57 - .../fuzz/transformation_add_type_struct.cpp | 106 - .../fuzz/transformation_add_type_struct.h | 63 - .../fuzz/transformation_add_type_vector.cpp | 86 - .../fuzz/transformation_add_type_vector.h | 57 - .../transformation_adjust_branch_weights.cpp | 102 - .../transformation_adjust_branch_weights.h | 59 - .../transformation_composite_construct.cpp | 339 - .../fuzz/transformation_composite_construct.h | 104 - .../fuzz/transformation_composite_extract.cpp | 147 - .../fuzz/transformation_composite_extract.h | 76 - .../fuzz/transformation_composite_insert.cpp | 246 - .../fuzz/transformation_composite_insert.h | 79 - ...tion_compute_data_synonym_fact_closure.cpp | 56 - ...mation_compute_data_synonym_fact_closure.h | 55 - .../source/fuzz/transformation_context.cpp | 68 - .../source/fuzz/transformation_context.h | 74 - ...mation_duplicate_region_with_selection.cpp | 721 - ...ormation_duplicate_region_with_selection.h | 91 - .../transformation_equation_instruction.cpp | 300 - .../transformation_equation_instruction.h | 78 - ...transformation_expand_vector_reduction.cpp | 169 - .../transformation_expand_vector_reduction.h | 105 - ...nsformation_flatten_conditional_branch.cpp | 1038 -- ...ransformation_flatten_conditional_branch.h | 159 - .../fuzz/transformation_function_call.cpp | 193 - .../fuzz/transformation_function_call.h | 69 - .../fuzz/transformation_inline_function.cpp | 364 - .../fuzz/transformation_inline_function.h | 78 - ...nsformation_invert_comparison_operator.cpp | 183 - ...ransformation_invert_comparison_operator.h | 65 - .../source/fuzz/transformation_load.cpp | 228 - .../source/fuzz/transformation_load.h | 72 - ...ormation_make_vector_operation_dynamic.cpp | 115 - ...sformation_make_vector_operation_dynamic.h | 65 - .../fuzz/transformation_merge_blocks.cpp | 89 - .../source/fuzz/transformation_merge_blocks.h | 59 - .../transformation_merge_function_returns.cpp | 848 - .../transformation_merge_function_returns.h | 116 - .../fuzz/transformation_move_block_down.cpp | 113 - .../fuzz/transformation_move_block_down.h | 58 - .../transformation_move_instruction_down.cpp | 734 - .../transformation_move_instruction_down.h | 107 - .../fuzz/transformation_mutate_pointer.cpp | 182 - .../fuzz/transformation_mutate_pointer.h | 79 - .../fuzz/transformation_outline_function.cpp | 1024 -- .../fuzz/transformation_outline_function.h | 229 - ...sformation_permute_function_parameters.cpp | 169 - ...ansformation_permute_function_parameters.h | 65 - .../transformation_permute_phi_operands.cpp | 99 - .../transformation_permute_phi_operands.h | 58 - ...nsformation_propagate_instruction_down.cpp | 592 - ...ransformation_propagate_instruction_down.h | 184 - ...ransformation_propagate_instruction_up.cpp | 417 - .../transformation_propagate_instruction_up.h | 91 - ...ransformation_push_id_through_variable.cpp | 182 - .../transformation_push_id_through_variable.h | 70 - ...sformation_record_synonymous_constants.cpp | 137 - ...ansformation_record_synonymous_constants.h | 73 - ...ace_add_sub_mul_with_carrying_extended.cpp | 236 - ...place_add_sub_mul_with_carrying_extended.h | 70 - ..._boolean_constant_with_constant_binary.cpp | 327 - ...ce_boolean_constant_with_constant_binary.h | 81 - ...place_branch_from_dead_block_with_exit.cpp | 171 - ...replace_branch_from_dead_block_with_exit.h | 87 - ...ormation_replace_constant_with_uniform.cpp | 304 - ...sformation_replace_constant_with_uniform.h | 99 - ...on_replace_copy_memory_with_load_store.cpp | 131 - ...tion_replace_copy_memory_with_load_store.h | 59 - ...on_replace_copy_object_with_store_load.cpp | 168 - ...tion_replace_copy_object_with_store_load.h | 65 - ...transformation_replace_id_with_synonym.cpp | 119 - .../transformation_replace_id_with_synonym.h | 62 - .../transformation_replace_irrelevant_id.cpp | 138 - .../transformation_replace_irrelevant_id.h | 68 - ...ion_replace_linear_algebra_instruction.cpp | 1040 -- ...ation_replace_linear_algebra_instruction.h | 93 - ...on_replace_load_store_with_copy_memory.cpp | 188 - ...tion_replace_load_store_with_copy_memory.h | 78 - ...replace_opphi_id_from_dead_predecessor.cpp | 114 - ...n_replace_opphi_id_from_dead_predecessor.h | 57 - ...place_opselect_with_conditional_branch.cpp | 208 - ...replace_opselect_with_conditional_branch.h | 62 - ...ormation_replace_parameter_with_global.cpp | 211 - ...sformation_replace_parameter_with_global.h | 70 - ...nsformation_replace_params_with_struct.cpp | 316 - ...ransformation_replace_params_with_struct.h | 91 - .../transformation_set_function_control.cpp | 105 - .../transformation_set_function_control.h | 63 - .../fuzz/transformation_set_loop_control.cpp | 227 - .../fuzz/transformation_set_loop_control.h | 83 - ...ransformation_set_memory_operands_mask.cpp | 231 - .../transformation_set_memory_operands_mask.h | 81 - .../transformation_set_selection_control.cpp | 65 - .../transformation_set_selection_control.h | 58 - .../fuzz/transformation_split_block.cpp | 164 - .../source/fuzz/transformation_split_block.h | 67 - .../source/fuzz/transformation_store.cpp | 251 - .../source/fuzz/transformation_store.h | 76 - ...ransformation_swap_commutable_operands.cpp | 68 - .../transformation_swap_commutable_operands.h | 55 - ...ation_swap_conditional_branch_operands.cpp | 115 - ...rmation_swap_conditional_branch_operands.h | 60 - ...transformation_swap_function_variables.cpp | 93 - .../transformation_swap_function_variables.h | 57 - .../transformation_swap_two_functions.cpp | 72 - .../fuzz/transformation_swap_two_functions.h | 56 - ...mation_toggle_access_chain_instruction.cpp | 85 - ...ormation_toggle_access_chain_instruction.h | 55 - .../fuzz/transformation_vector_shuffle.cpp | 238 - .../fuzz/transformation_vector_shuffle.h | 95 - ...tion_wrap_early_terminator_in_function.cpp | 182 - ...mation_wrap_early_terminator_in_function.h | 73 - ...ransformation_wrap_region_in_selection.cpp | 166 - .../transformation_wrap_region_in_selection.h | 88 - .../transformation_wrap_vector_synonym.cpp | 200 - .../fuzz/transformation_wrap_vector_synonym.h | 80 - .../uniform_buffer_element_descriptor.cpp | 118 - .../fuzz/uniform_buffer_element_descriptor.h | 52 - .../spirv-tools/source/instruction.h | 49 - .../latest_version_glsl_std_450_header.h | 20 - .../source/latest_version_opencl_std_header.h | 20 - .../source/latest_version_spirv_header.h | 20 - .../spirv-tools/source/libspirv.cpp | 135 - .../spirv-tools/source/link/CMakeLists.txt | 46 - .../spirv-tools/source/link/linker.cpp | 820 - .../spirv-tools/source/lint/CMakeLists.txt | 61 - .../source/lint/divergence_analysis.cpp | 245 - .../source/lint/divergence_analysis.h | 163 - .../lint/lint_divergent_derivatives.cpp | 169 - .../spirv-tools/source/lint/linter.cpp | 60 - .../spirv-tools/source/lint/lints.h | 34 - .../third_party/spirv-tools/source/macro.h | 25 - .../spirv-tools/source/name_mapper.cpp | 331 - .../spirv-tools/source/name_mapper.h | 122 - .../third_party/spirv-tools/source/opcode.cpp | 769 - .../third_party/spirv-tools/source/opcode.h | 161 - .../spirv-tools/source/operand.cpp | 617 - .../third_party/spirv-tools/source/operand.h | 151 - .../spirv-tools/source/opt/CMakeLists.txt | 272 - .../opt/aggressive_dead_code_elim_pass.cpp | 1083 -- .../opt/aggressive_dead_code_elim_pass.h | 255 - .../spirv-tools/source/opt/amd_ext_to_khr.cpp | 970 -- .../spirv-tools/source/opt/amd_ext_to_khr.h | 51 - .../spirv-tools/source/opt/basic_block.cpp | 287 - .../spirv-tools/source/opt/basic_block.h | 342 - .../source/opt/block_merge_pass.cpp | 54 - .../spirv-tools/source/opt/block_merge_pass.h | 62 - .../source/opt/block_merge_util.cpp | 196 - .../spirv-tools/source/opt/block_merge_util.h | 44 - .../spirv-tools/source/opt/build_module.cpp | 88 - .../spirv-tools/source/opt/build_module.h | 54 - .../spirv-tools/source/opt/ccp_pass.cpp | 380 - .../spirv-tools/source/opt/ccp_pass.h | 133 - .../spirv-tools/source/opt/cfg.cpp | 338 - .../third_party/spirv-tools/source/opt/cfg.h | 181 - .../source/opt/cfg_cleanup_pass.cpp | 39 - .../spirv-tools/source/opt/cfg_cleanup_pass.h | 41 - .../spirv-tools/source/opt/code_sink.cpp | 322 - .../spirv-tools/source/opt/code_sink.h | 107 - .../source/opt/combine_access_chains.cpp | 294 - .../source/opt/combine_access_chains.h | 83 - .../source/opt/compact_ids_pass.cpp | 100 - .../spirv-tools/source/opt/compact_ids_pass.h | 42 - .../spirv-tools/source/opt/composite.cpp | 52 - .../spirv-tools/source/opt/composite.h | 51 - .../source/opt/const_folding_rules.cpp | 1373 -- .../source/opt/const_folding_rules.h | 130 - .../spirv-tools/source/opt/constants.cpp | 482 - .../spirv-tools/source/opt/constants.h | 727 - .../source/opt/control_dependence.cpp | 156 - .../source/opt/control_dependence.h | 197 - .../source/opt/convert_to_half_pass.cpp | 483 - .../source/opt/convert_to_half_pass.h | 148 - .../opt/convert_to_sampled_image_pass.cpp | 437 - .../opt/convert_to_sampled_image_pass.h | 207 - .../source/opt/copy_prop_arrays.cpp | 862 - .../spirv-tools/source/opt/copy_prop_arrays.h | 235 - .../spirv-tools/source/opt/dataflow.cpp | 91 - .../spirv-tools/source/opt/dataflow.h | 148 - .../source/opt/dead_branch_elim_pass.cpp | 663 - .../source/opt/dead_branch_elim_pass.h | 176 - .../source/opt/dead_insert_elim_pass.cpp | 264 - .../source/opt/dead_insert_elim_pass.h | 90 - .../source/opt/dead_variable_elimination.cpp | 111 - .../source/opt/dead_variable_elimination.h | 56 - .../source/opt/debug_info_manager.cpp | 923 - .../source/opt/debug_info_manager.h | 277 - .../source/opt/decoration_manager.cpp | 636 - .../source/opt/decoration_manager.h | 210 - .../source/opt/def_use_manager.cpp | 313 - .../spirv-tools/source/opt/def_use_manager.h | 252 - .../spirv-tools/source/opt/desc_sroa.cpp | 416 - .../spirv-tools/source/opt/desc_sroa.h | 144 - .../spirv-tools/source/opt/desc_sroa_util.cpp | 117 - .../spirv-tools/source/opt/desc_sroa_util.h | 54 - .../source/opt/dominator_analysis.cpp | 81 - .../source/opt/dominator_analysis.h | 138 - .../spirv-tools/source/opt/dominator_tree.cpp | 398 - .../spirv-tools/source/opt/dominator_tree.h | 305 - .../opt/eliminate_dead_constant_pass.cpp | 104 - .../source/opt/eliminate_dead_constant_pass.h | 35 - .../opt/eliminate_dead_functions_pass.cpp | 52 - .../opt/eliminate_dead_functions_pass.h | 44 - .../opt/eliminate_dead_functions_util.cpp | 66 - .../opt/eliminate_dead_functions_util.h | 36 - .../opt/eliminate_dead_members_pass.cpp | 691 - .../source/opt/eliminate_dead_members_pass.h | 146 - .../spirv-tools/source/opt/empty_pass.h | 36 - .../source/opt/feature_manager.cpp | 119 - .../spirv-tools/source/opt/feature_manager.h | 108 - .../source/opt/fix_storage_class.cpp | 340 - .../source/opt/fix_storage_class.h | 93 - .../source/opt/flatten_decoration_pass.cpp | 165 - .../source/opt/flatten_decoration_pass.h | 35 - .../spirv-tools/source/opt/fold.cpp | 711 - .../third_party/spirv-tools/source/opt/fold.h | 187 - ...ld_spec_constant_op_and_composite_pass.cpp | 445 - ...fold_spec_constant_op_and_composite_pass.h | 82 - .../spirv-tools/source/opt/folding_rules.cpp | 2636 --- .../spirv-tools/source/opt/folding_rules.h | 118 - .../opt/freeze_spec_constant_value_pass.cpp | 53 - .../opt/freeze_spec_constant_value_pass.h | 35 - .../spirv-tools/source/opt/function.cpp | 274 - .../spirv-tools/source/opt/function.h | 268 - .../opt/graphics_robust_access_pass.cpp | 1058 -- .../source/opt/graphics_robust_access_pass.h | 156 - .../spirv-tools/source/opt/if_conversion.cpp | 287 - .../spirv-tools/source/opt/if_conversion.h | 89 - .../source/opt/inline_exhaustive_pass.cpp | 80 - .../source/opt/inline_exhaustive_pass.h | 53 - .../source/opt/inline_opaque_pass.cpp | 120 - .../source/opt/inline_opaque_pass.h | 60 - .../spirv-tools/source/opt/inline_pass.cpp | 801 - .../spirv-tools/source/opt/inline_pass.h | 243 - .../source/opt/inst_bindless_check_pass.cpp | 841 - .../source/opt/inst_bindless_check_pass.h | 209 - .../source/opt/inst_buff_addr_check_pass.cpp | 493 - .../source/opt/inst_buff_addr_check_pass.h | 135 - .../source/opt/inst_debug_printf_pass.cpp | 264 - .../source/opt/inst_debug_printf_pass.h | 95 - .../spirv-tools/source/opt/instruction.cpp | 1070 -- .../spirv-tools/source/opt/instruction.h | 903 - .../source/opt/instruction_list.cpp | 36 - .../spirv-tools/source/opt/instruction_list.h | 140 - .../source/opt/instrument_pass.cpp | 1124 -- .../spirv-tools/source/opt/instrument_pass.h | 475 - .../source/opt/interp_fixup_pass.cpp | 131 - .../source/opt/interp_fixup_pass.h | 54 - .../spirv-tools/source/opt/ir_builder.h | 636 - .../spirv-tools/source/opt/ir_context.cpp | 1047 -- .../spirv-tools/source/opt/ir_context.h | 1183 -- .../spirv-tools/source/opt/ir_loader.cpp | 365 - .../spirv-tools/source/opt/ir_loader.h | 101 - .../spirv-tools/source/opt/iterator.h | 350 - .../spirv-tools/source/opt/licm_pass.cpp | 140 - .../spirv-tools/source/opt/licm_pass.h | 72 - .../opt/local_access_chain_convert_pass.cpp | 441 - .../opt/local_access_chain_convert_pass.h | 133 - .../opt/local_redundancy_elimination.cpp | 67 - .../source/opt/local_redundancy_elimination.h | 68 - .../opt/local_single_block_elim_pass.cpp | 293 - .../source/opt/local_single_block_elim_pass.h | 107 - .../opt/local_single_store_elim_pass.cpp | 328 - .../source/opt/local_single_store_elim_pass.h | 108 - .../third_party/spirv-tools/source/opt/log.h | 235 - .../source/opt/loop_dependence.cpp | 1675 -- .../spirv-tools/source/opt/loop_dependence.h | 560 - .../source/opt/loop_dependence_helpers.cpp | 541 - .../source/opt/loop_descriptor.cpp | 1025 -- .../spirv-tools/source/opt/loop_descriptor.h | 576 - .../spirv-tools/source/opt/loop_fission.cpp | 513 - .../spirv-tools/source/opt/loop_fission.h | 78 - .../spirv-tools/source/opt/loop_fusion.cpp | 730 - .../spirv-tools/source/opt/loop_fusion.h | 114 - .../source/opt/loop_fusion_pass.cpp | 69 - .../spirv-tools/source/opt/loop_fusion_pass.h | 51 - .../spirv-tools/source/opt/loop_peeling.cpp | 1085 -- .../spirv-tools/source/opt/loop_peeling.h | 336 - .../spirv-tools/source/opt/loop_unroller.cpp | 1130 -- .../spirv-tools/source/opt/loop_unroller.h | 49 - .../source/opt/loop_unswitch_pass.cpp | 620 - .../source/opt/loop_unswitch_pass.h | 43 - .../spirv-tools/source/opt/loop_utils.cpp | 694 - .../spirv-tools/source/opt/loop_utils.h | 182 - .../spirv-tools/source/opt/mem_pass.cpp | 509 - .../spirv-tools/source/opt/mem_pass.h | 164 - .../source/opt/merge_return_pass.cpp | 888 - .../source/opt/merge_return_pass.h | 337 - .../spirv-tools/source/opt/module.cpp | 278 - .../spirv-tools/source/opt/module.h | 532 - .../spirv-tools/source/opt/null_pass.h | 34 - .../spirv-tools/source/opt/optimizer.cpp | 1012 -- .../spirv-tools/source/opt/pass.cpp | 155 - .../third_party/spirv-tools/source/opt/pass.h | 164 - .../spirv-tools/source/opt/pass_manager.cpp | 93 - .../spirv-tools/source/opt/pass_manager.h | 158 - .../spirv-tools/source/opt/passes.h | 85 - .../spirv-tools/source/opt/pch_source_opt.cpp | 15 - .../spirv-tools/source/opt/pch_source_opt.h | 32 - .../source/opt/private_to_local_pass.cpp | 237 - .../source/opt/private_to_local_pass.h | 73 - .../spirv-tools/source/opt/propagator.cpp | 291 - .../spirv-tools/source/opt/propagator.h | 317 - .../source/opt/reduce_load_size.cpp | 184 - .../spirv-tools/source/opt/reduce_load_size.h | 73 - .../source/opt/redundancy_elimination.cpp | 60 - .../source/opt/redundancy_elimination.h | 56 - .../spirv-tools/source/opt/reflect.h | 67 - .../source/opt/register_pressure.cpp | 583 - .../source/opt/register_pressure.h | 196 - .../source/opt/relax_float_ops_pass.cpp | 178 - .../source/opt/relax_float_ops_pass.h | 80 - .../source/opt/remove_duplicates_pass.cpp | 212 - .../source/opt/remove_duplicates_pass.h | 61 - ...remove_unused_interface_variables_pass.cpp | 93 - .../remove_unused_interface_variables_pass.h | 26 - ...lace_desc_array_access_using_var_index.cpp | 423 - ...eplace_desc_array_access_using_var_index.h | 204 - .../source/opt/replace_invalid_opc.cpp | 217 - .../source/opt/replace_invalid_opc.h | 67 - .../source/opt/scalar_analysis.cpp | 988 -- .../spirv-tools/source/opt/scalar_analysis.h | 314 - .../source/opt/scalar_analysis_nodes.h | 347 - .../opt/scalar_analysis_simplification.cpp | 539 - .../source/opt/scalar_replacement_pass.cpp | 1018 -- .../source/opt/scalar_replacement_pass.h | 264 - .../set_spec_constant_default_value_pass.cpp | 393 - .../set_spec_constant_default_value_pass.h | 114 - .../source/opt/simplification_pass.cpp | 169 - .../source/opt/simplification_pass.h | 58 - .../source/opt/spread_volatile_semantics.cpp | 314 - .../source/opt/spread_volatile_semantics.h | 110 - .../source/opt/ssa_rewrite_pass.cpp | 773 - .../spirv-tools/source/opt/ssa_rewrite_pass.h | 315 - .../source/opt/strength_reduction_pass.cpp | 200 - .../source/opt/strength_reduction_pass.h | 65 - .../source/opt/strip_debug_info_pass.cpp | 110 - .../source/opt/strip_debug_info_pass.h | 35 - .../opt/strip_nonsemantic_info_pass.cpp | 115 - .../source/opt/strip_nonsemantic_info_pass.h | 44 - .../source/opt/struct_cfg_analysis.cpp | 250 - .../source/opt/struct_cfg_analysis.h | 160 - .../spirv-tools/source/opt/tree_iterator.h | 246 - .../spirv-tools/source/opt/type_manager.cpp | 1052 -- .../spirv-tools/source/opt/type_manager.h | 292 - .../spirv-tools/source/opt/types.cpp | 702 - .../spirv-tools/source/opt/types.h | 673 - .../source/opt/unify_const_pass.cpp | 177 - .../spirv-tools/source/opt/unify_const_pass.h | 35 - .../source/opt/upgrade_memory_model.cpp | 768 - .../source/opt/upgrade_memory_model.h | 150 - .../source/opt/value_number_table.cpp | 240 - .../source/opt/value_number_table.h | 91 - .../spirv-tools/source/opt/vector_dce.cpp | 433 - .../spirv-tools/source/opt/vector_dce.h | 160 - .../spirv-tools/source/opt/workaround1209.cpp | 69 - .../spirv-tools/source/opt/workaround1209.h | 41 - .../spirv-tools/source/opt/wrap_opkill.cpp | 199 - .../spirv-tools/source/opt/wrap_opkill.h | 80 - .../spirv-tools/source/parsed_operand.cpp | 74 - .../spirv-tools/source/parsed_operand.h | 33 - .../spirv-tools/source/pch_source.cpp | 15 - .../spirv-tools/source/pch_source.h | 15 - .../third_party/spirv-tools/source/print.cpp | 126 - .../third_party/spirv-tools/source/print.h | 75 - .../spirv-tools/source/reduce/CMakeLists.txt | 116 - .../change_operand_reduction_opportunity.cpp | 35 - .../change_operand_reduction_opportunity.h | 54 - ...operand_to_undef_reduction_opportunity.cpp | 42 - ...e_operand_to_undef_reduction_opportunity.h | 53 - ..._conditional_branch_opportunity_finder.cpp | 87 - ...le_conditional_branch_opportunity_finder.h | 37 - ...nditional_branch_reduction_opportunity.cpp | 68 - ...conditional_branch_reduction_opportunity.h | 54 - .../merge_blocks_reduction_opportunity.cpp | 81 - .../merge_blocks_reduction_opportunity.h | 53 - ...ge_blocks_reduction_opportunity_finder.cpp | 46 - ...erge_blocks_reduction_opportunity_finder.h | 42 - ..._to_const_reduction_opportunity_finder.cpp | 81 - ...nd_to_const_reduction_opportunity_finder.h | 44 - ...nating_id_reduction_opportunity_finder.cpp | 114 - ...minating_id_reduction_opportunity_finder.h | 56 - ..._to_undef_reduction_opportunity_finder.cpp | 92 - ...nd_to_undef_reduction_opportunity_finder.h | 43 - .../source/reduce/pch_source_reduce.cpp | 15 - .../source/reduce/pch_source_reduce.h | 23 - .../spirv-tools/source/reduce/reducer.cpp | 249 - .../spirv-tools/source/reduce/reducer.h | 122 - .../source/reduce/reduction_opportunity.cpp | 27 - .../source/reduce/reduction_opportunity.h | 47 - .../reduce/reduction_opportunity_finder.cpp | 34 - .../reduce/reduction_opportunity_finder.h | 58 - .../source/reduce/reduction_pass.cpp | 86 - .../source/reduce/reduction_pass.h | 86 - .../source/reduce/reduction_util.cpp | 119 - .../source/reduce/reduction_util.h | 51 - .../remove_block_reduction_opportunity.cpp | 51 - .../remove_block_reduction_opportunity.h | 48 - ...ove_block_reduction_opportunity_finder.cpp | 95 - ...emove_block_reduction_opportunity_finder.h | 55 - .../remove_function_reduction_opportunity.cpp | 41 - .../remove_function_reduction_opportunity.h | 49 - ..._function_reduction_opportunity_finder.cpp | 50 - ...ve_function_reduction_opportunity_finder.h | 42 - ...move_instruction_reduction_opportunity.cpp | 41 - ...remove_instruction_reduction_opportunity.h | 44 - ...remove_selection_reduction_opportunity.cpp | 31 - .../remove_selection_reduction_opportunity.h | 47 - ...selection_reduction_opportunity_finder.cpp | 146 - ...e_selection_reduction_opportunity_finder.h | 49 - ...ve_struct_member_reduction_opportunity.cpp | 210 - ...move_struct_member_reduction_opportunity.h | 84 - ...struction_reduction_opportunity_finder.cpp | 176 - ...instruction_reduction_opportunity_finder.h | 61 - ...ct_member_reduction_opportunity_finder.cpp | 200 - ...ruct_member_reduction_opportunity_finder.h | 61 - ...al_branch_to_branch_opportunity_finder.cpp | 62 - ...onal_branch_to_branch_opportunity_finder.h | 37 - ...branch_to_branch_reduction_opportunity.cpp | 59 - ...l_branch_to_branch_reduction_opportunity.h | 45 - ...nstruct_to_block_reduction_opportunity.cpp | 67 - ...construct_to_block_reduction_opportunity.h | 49 - ..._to_block_reduction_opportunity_finder.cpp | 185 - ...ct_to_block_reduction_opportunity_finder.h | 57 - ...oop_to_selection_reduction_opportunity.cpp | 285 - ..._loop_to_selection_reduction_opportunity.h | 93 - ...selection_reduction_opportunity_finder.cpp | 102 - ...o_selection_reduction_opportunity_finder.h | 57 - .../spirv-tools/source/software_version.cpp | 27 - .../spirv-tools/source/spirv_constant.h | 101 - .../spirv-tools/source/spirv_definition.h | 33 - .../spirv-tools/source/spirv_endian.cpp | 77 - .../spirv-tools/source/spirv_endian.h | 37 - .../source/spirv_fuzzer_options.cpp | 68 - .../spirv-tools/source/spirv_fuzzer_options.h | 48 - .../source/spirv_optimizer_options.cpp | 51 - .../source/spirv_optimizer_options.h | 49 - .../source/spirv_reducer_options.cpp | 51 - .../source/spirv_reducer_options.h | 38 - .../spirv-tools/source/spirv_target_env.cpp | 424 - .../spirv-tools/source/spirv_target_env.h | 49 - .../source/spirv_validator_options.cpp | 127 - .../source/spirv_validator_options.h | 65 - .../third_party/spirv-tools/source/table.cpp | 68 - .../third_party/spirv-tools/source/table.h | 133 - .../third_party/spirv-tools/source/text.cpp | 847 - .../third_party/spirv-tools/source/text.h | 53 - .../spirv-tools/source/text_handler.cpp | 393 - .../spirv-tools/source/text_handler.h | 264 - .../spirv-tools/source/util/bit_vector.cpp | 82 - .../spirv-tools/source/util/bit_vector.h | 119 - .../spirv-tools/source/util/bitutils.h | 187 - .../spirv-tools/source/util/hex_float.h | 1164 -- .../spirv-tools/source/util/ilist.h | 365 - .../spirv-tools/source/util/ilist_node.h | 265 - .../spirv-tools/source/util/make_unique.h | 30 - .../spirv-tools/source/util/parse_number.cpp | 217 - .../spirv-tools/source/util/parse_number.h | 252 - .../spirv-tools/source/util/small_vector.h | 469 - .../spirv-tools/source/util/string_utils.cpp | 58 - .../spirv-tools/source/util/string_utils.h | 131 - .../spirv-tools/source/util/timer.cpp | 102 - .../spirv-tools/source/util/timer.h | 392 - .../spirv-tools/source/val/basic_block.cpp | 143 - .../spirv-tools/source/val/basic_block.h | 249 - .../spirv-tools/source/val/construct.cpp | 235 - .../spirv-tools/source/val/construct.h | 170 - .../spirv-tools/source/val/decoration.h | 89 - .../spirv-tools/source/val/function.cpp | 419 - .../spirv-tools/source/val/function.h | 400 - .../spirv-tools/source/val/instruction.cpp | 55 - .../spirv-tools/source/val/instruction.h | 155 - .../spirv-tools/source/val/validate.cpp | 445 - .../spirv-tools/source/val/validate.h | 242 - .../source/val/validate_adjacency.cpp | 131 - .../source/val/validate_annotation.cpp | 647 - .../source/val/validate_arithmetics.cpp | 550 - .../source/val/validate_atomics.cpp | 397 - .../source/val/validate_barriers.cpp | 136 - .../source/val/validate_bitwise.cpp | 219 - .../source/val/validate_builtins.cpp | 4289 ----- .../source/val/validate_capability.cpp | 361 - .../spirv-tools/source/val/validate_cfg.cpp | 1092 -- .../source/val/validate_composites.cpp | 615 - .../source/val/validate_constants.cpp | 468 - .../source/val/validate_conversion.cpp | 564 - .../spirv-tools/source/val/validate_debug.cpp | 74 - .../source/val/validate_decorations.cpp | 1734 -- .../source/val/validate_derivatives.cpp | 112 - .../val/validate_execution_limitations.cpp | 72 - .../source/val/validate_extensions.cpp | 3302 ---- .../source/val/validate_function.cpp | 358 - .../spirv-tools/source/val/validate_id.cpp | 245 - .../spirv-tools/source/val/validate_image.cpp | 2184 --- .../source/val/validate_instruction.cpp | 500 - .../source/val/validate_interfaces.cpp | 551 - .../source/val/validate_layout.cpp | 386 - .../source/val/validate_literals.cpp | 99 - .../source/val/validate_logicals.cpp | 286 - .../source/val/validate_memory.cpp | 1663 -- .../source/val/validate_memory_semantics.cpp | 261 - .../source/val/validate_memory_semantics.h | 29 - .../spirv-tools/source/val/validate_misc.cpp | 204 - .../source/val/validate_mode_setting.cpp | 546 - .../source/val/validate_non_uniform.cpp | 90 - .../source/val/validate_primitives.cpp | 75 - .../source/val/validate_scopes.cpp | 298 - .../spirv-tools/source/val/validate_scopes.h | 33 - .../source/val/validate_small_type_uses.cpp | 57 - .../spirv-tools/source/val/validate_type.cpp | 657 - .../source/val/validation_state.cpp | 1904 --- .../spirv-tools/source/val/validation_state.h | 901 - .../spirv-tools/source/wasm/README.md | 43 - .../spirv-tools/source/wasm/build.sh | 78 - .../spirv-tools/source/wasm/package.json | 17 - .../spirv-tools/source/wasm/spirv-tools.cpp | 94 - .../spirv-tools/source/wasm/spirv-tools.d.ts | 57 - .../spirv-tools/tools/CMakeLists.txt | 73 - .../third_party/spirv-tools/tools/as/as.cpp | 154 - .../spirv-tools/tools/cfg/bin_to_dot.cpp | 187 - .../spirv-tools/tools/cfg/bin_to_dot.h | 28 - .../third_party/spirv-tools/tools/cfg/cfg.cpp | 127 - .../third_party/spirv-tools/tools/dis/dis.cpp | 216 - .../spirv-tools/tools/emacs/50spirv-tools.el | 40 - .../spirv-tools/tools/emacs/CMakeLists.txt | 48 - .../spirv-tools/tools/fuzz/fuzz.cpp | 844 - .../third_party/spirv-tools/tools/io.h | 142 - .../spirv-tools/tools/lesspipe/CMakeLists.txt | 28 - .../tools/lesspipe/spirv-lesspipe.sh | 27 - .../spirv-tools/tools/link/linker.cpp | 173 - .../spirv-tools/tools/lint/lint.cpp | 75 - .../third_party/spirv-tools/tools/opt/opt.cpp | 860 - .../spirv-tools/tools/reduce/reduce.cpp | 368 - .../spirv-tools/tools/sva/.eslintrc.json | 25 - .../spirv-tools/tools/sva/README.md | 41 - .../spirv-tools/tools/sva/bin/sva.js | 32 - .../spirv-tools/tools/sva/mocha.opts | 1 - .../spirv-tools/tools/sva/package.json | 25 - .../spirv-tools/tools/sva/rollup.config.js | 7 - .../spirv-tools/tools/sva/src/assembler.js | 98 - .../tools/sva/src/assembler_test.js | 165 - .../spirv-tools/tools/sva/src/ast.js | 141 - .../spirv-tools/tools/sva/src/lexer.js | 363 - .../spirv-tools/tools/sva/src/lexer_test.js | 191 - .../spirv-tools/tools/sva/src/parser.js | 283 - .../spirv-tools/tools/sva/src/parser_test.js | 489 - .../spirv-tools/tools/sva/src/spirv.data.js | 4567 ----- .../spirv-tools/tools/sva/src/sva.js | 40 - .../spirv-tools/tools/sva/src/token.js | 55 - .../tools/sva/tests/empty_main.spv_asm | 18 - .../spirv-tools/tools/sva/tests/index.html | 23 - .../tools/sva/tests/simple.spv_asm | 30 - .../tools/sva/tools/process_grammar.rb | 119 - .../spirv-tools/tools/sva/yarn.lock | 1778 -- .../spirv-tools/tools/util/cli_consumer.cpp | 45 - .../spirv-tools/tools/util/cli_consumer.h | 31 - .../third_party/spirv-tools/tools/val/val.cpp | 204 - .../spirv-tools/utils/check_code_format.sh | 39 - .../spirv-tools/utils/check_copyright.py | 231 - .../spirv-tools/utils/check_symbol_exports.py | 119 - .../spirv-tools/utils/fixup_fuzz_result.py | 25 - .../utils/generate_grammar_tables.py | 874 - .../utils/generate_language_headers.py | 185 - .../utils/generate_registry_tables.py | 90 - .../spirv-tools/utils/generate_vim_syntax.py | 205 - .../spirv-tools/utils/git-sync-deps | 282 - .../spirv-tools/utils/roll_deps.sh | 51 - .../spirv-tools/utils/update_build_version.py | 148 - lib/shaderc/utils/add_copyright.py | 146 - lib/shaderc/utils/git-sync-deps | 282 - lib/shaderc/utils/remove-file-by-suffix.py | 35 - lib/shaderc/utils/roll-deps | 53 - lib/shaderc/utils/update_build_version.py | 154 - switch/make.sh | 2 +- 1340 files changed, 32 insertions(+), 478502 deletions(-) delete mode 100644 lib/shaderc/.clang-format delete mode 100644 lib/shaderc/AUTHORS delete mode 100644 lib/shaderc/Android.mk delete mode 100644 lib/shaderc/BUILD.gn delete mode 100644 lib/shaderc/CHANGES delete mode 100644 lib/shaderc/CMakeLists.txt delete mode 100644 lib/shaderc/CONTRIBUTING.md delete mode 100644 lib/shaderc/CONTRIBUTORS delete mode 100644 lib/shaderc/DEPS delete mode 100644 lib/shaderc/DEVELOPMENT.howto.md delete mode 100644 lib/shaderc/Dockerfile delete mode 100644 lib/shaderc/LICENSE delete mode 100644 lib/shaderc/README.md delete mode 100644 lib/shaderc/cmake/linux-mingw-toolchain.cmake delete mode 100644 lib/shaderc/cmake/setup_build.cmake delete mode 100644 lib/shaderc/cmake/shaderc.pc.in delete mode 100644 lib/shaderc/cmake/shaderc_combined.pc.in delete mode 100644 lib/shaderc/cmake/shaderc_static.pc.in delete mode 100644 lib/shaderc/cmake/utils.cmake delete mode 100644 lib/shaderc/cmake/write_pkg_config.cmake delete mode 100644 lib/shaderc/downloads.md delete mode 100644 lib/shaderc/libshaderc/Android.mk delete mode 100644 lib/shaderc/libshaderc/CMakeLists.txt delete mode 100644 lib/shaderc/libshaderc/README.md delete mode 100644 lib/shaderc/libshaderc/include/shaderc/env.h delete mode 100644 lib/shaderc/libshaderc/include/shaderc/shaderc.h delete mode 100644 lib/shaderc/libshaderc/include/shaderc/shaderc.hpp delete mode 100644 lib/shaderc/libshaderc/include/shaderc/status.h delete mode 100644 lib/shaderc/libshaderc/include/shaderc/visibility.h delete mode 100644 lib/shaderc/libshaderc/src/common_shaders_for_test.h delete mode 100644 lib/shaderc/libshaderc/src/shaderc.cc delete mode 100644 lib/shaderc/libshaderc/src/shaderc_c_smoke_test.c delete mode 100644 lib/shaderc/libshaderc/src/shaderc_cpp_test.cc delete mode 100644 lib/shaderc/libshaderc/src/shaderc_private.h delete mode 100644 lib/shaderc/libshaderc/src/shaderc_private_test.cc delete mode 100644 lib/shaderc/libshaderc/src/shaderc_test.cc delete mode 100644 lib/shaderc/libshaderc_util/Android.mk delete mode 100644 lib/shaderc/libshaderc_util/CMakeLists.txt delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/args.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/compiler.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/counting_includer.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/exceptions.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/file_finder.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/format.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/io_shaderc.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/message.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/mutex.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/resources.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/resources.inc delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/shader_stage.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/string_piece.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/universal_unistd.h delete mode 100644 lib/shaderc/libshaderc_util/include/libshaderc_util/version_profile.h delete mode 100644 lib/shaderc/libshaderc_util/src/args.cc delete mode 100644 lib/shaderc/libshaderc_util/src/compiler.cc delete mode 100644 lib/shaderc/libshaderc_util/src/compiler_test.cc delete mode 100644 lib/shaderc/libshaderc_util/src/counting_includer_test.cc delete mode 100644 lib/shaderc/libshaderc_util/src/death_test.h delete mode 100644 lib/shaderc/libshaderc_util/src/file_finder.cc delete mode 100644 lib/shaderc/libshaderc_util/src/file_finder_test.cc delete mode 100644 lib/shaderc/libshaderc_util/src/format_test.cc delete mode 100644 lib/shaderc/libshaderc_util/src/io_shaderc.cc delete mode 100644 lib/shaderc/libshaderc_util/src/io_shaderc_test.cc delete mode 100644 lib/shaderc/libshaderc_util/src/message.cc delete mode 100644 lib/shaderc/libshaderc_util/src/message_test.cc delete mode 100644 lib/shaderc/libshaderc_util/src/mutex_test.cc delete mode 100644 lib/shaderc/libshaderc_util/src/resources.cc delete mode 100644 lib/shaderc/libshaderc_util/src/shader_stage.cc delete mode 100644 lib/shaderc/libshaderc_util/src/spirv_tools_wrapper.cc delete mode 100644 lib/shaderc/libshaderc_util/src/string_piece_test.cc delete mode 100644 lib/shaderc/libshaderc_util/src/version_profile.cc delete mode 100644 lib/shaderc/libshaderc_util/src/version_profile_test.cc delete mode 100644 lib/shaderc/libshaderc_util/testdata/copy-to-build.cmake delete mode 100644 lib/shaderc/libshaderc_util/testdata/dir/subdir/include_file.2 delete mode 100644 lib/shaderc/libshaderc_util/testdata/include_file.1 delete mode 100644 lib/shaderc/license-checker.cfg delete mode 100644 lib/shaderc/third_party/Android.mk delete mode 100644 lib/shaderc/third_party/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/LICENSE.glslang delete mode 100644 lib/shaderc/third_party/LICENSE.spirv-tools delete mode 100644 lib/shaderc/third_party/glslang/.appveyor.yml delete mode 100644 lib/shaderc/third_party/glslang/.clang-format delete mode 100644 lib/shaderc/third_party/glslang/.gitattributes delete mode 100644 lib/shaderc/third_party/glslang/.github/workflows/continuous_deployment.yml delete mode 100644 lib/shaderc/third_party/glslang/.github/workflows/continuous_integration.yml delete mode 100644 lib/shaderc/third_party/glslang/.github/workflows/deploy.js delete mode 100644 lib/shaderc/third_party/glslang/.gn delete mode 100644 lib/shaderc/third_party/glslang/Android.mk delete mode 100644 lib/shaderc/third_party/glslang/BUILD.bazel delete mode 100644 lib/shaderc/third_party/glslang/BUILD.gn delete mode 100644 lib/shaderc/third_party/glslang/CHANGES.md delete mode 100644 lib/shaderc/third_party/glslang/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/CODE_OF_CONDUCT.md delete mode 100644 lib/shaderc/third_party/glslang/ChooseMSVCCRT.cmake delete mode 100644 lib/shaderc/third_party/glslang/DEPS delete mode 100644 lib/shaderc/third_party/glslang/External/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/LICENSE.txt delete mode 100644 lib/shaderc/third_party/glslang/OGLCompilersDLL/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/OGLCompilersDLL/InitializeDll.cpp delete mode 100644 lib/shaderc/third_party/glslang/OGLCompilersDLL/InitializeDll.h delete mode 100644 lib/shaderc/third_party/glslang/README-spirv-remap.txt delete mode 100644 lib/shaderc/third_party/glslang/README.md delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/CInterface/spirv_c_interface.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.AMD.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.EXT.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.KHR.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.NV.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/GLSL.std.450.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/GlslangToSpv.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/GlslangToSpv.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/InReadableOrder.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/Logger.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/Logger.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/NonSemanticDebugPrintf.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/SPVRemapper.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/SPVRemapper.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/SpvBuilder.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/SpvBuilder.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/SpvPostProcess.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/SpvTools.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/SpvTools.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/bitutils.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/disassemble.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/disassemble.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/doc.cpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/doc.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/hex_float.h delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/spirv.hpp delete mode 100644 lib/shaderc/third_party/glslang/SPIRV/spvIR.h delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/DirStackFileIncluder.h delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/ResourceLimits.cpp delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/ResourceLimits.h delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/StandAlone.cpp delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/Worklist.h delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/resource_limits_c.cpp delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/resource_limits_c.h delete mode 100644 lib/shaderc/third_party/glslang/StandAlone/spirv-remap.cpp delete mode 100644 lib/shaderc/third_party/glslang/WORKSPACE delete mode 100644 lib/shaderc/third_party/glslang/_config.yml delete mode 100644 lib/shaderc/third_party/glslang/build_info.h.tmpl delete mode 100755 lib/shaderc/third_party/glslang/build_info.py delete mode 100644 lib/shaderc/third_party/glslang/build_overrides/build.gni delete mode 100644 lib/shaderc/third_party/glslang/build_overrides/glslang.gni delete mode 100644 lib/shaderc/third_party/glslang/build_overrides/spirv_tools.gni delete mode 100644 lib/shaderc/third_party/glslang/gen_extension_headers.py delete mode 100644 lib/shaderc/third_party/glslang/glslang/CInterface/glslang_c_interface.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/glslang/ExtensionHeaders/GL_EXT_shader_realtime_clock.glsl delete mode 100644 lib/shaderc/third_party/glslang/glslang/GenericCodeGen/CodeGen.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/GenericCodeGen/Link.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslAttributes.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslAttributes.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslGrammar.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslGrammar.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslOpMap.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslOpMap.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslParseHelper.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslParseHelper.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslParseables.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslParseables.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslScanContext.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslScanContext.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslTokenStream.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslTokenStream.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/hlslTokens.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/HLSL/pch.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/BaseTypes.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/Common.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/ConstantUnion.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/InfoSink.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/InitializeGlobals.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/PoolAlloc.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/ResourceLimits.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/ShHandle.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/SpirvIntrinsics.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/Types.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/arrays.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/glslang_c_interface.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/glslang_c_shader_types.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Include/intermediate.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/Constant.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/InfoSink.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/Initialize.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/Initialize.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/IntermTraverse.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/Intermediate.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/LiveTraverser.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/ParseContextBase.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/ParseHelper.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/ParseHelper.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/PoolAlloc.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/RemoveTree.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/RemoveTree.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/Scan.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/Scan.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/ScanContext.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/ShaderLang.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/SpirvIntrinsics.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/SymbolTable.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/SymbolTable.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/Versions.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/Versions.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/attribute.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/attribute.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/gl_types.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/glslang.m4 delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/glslang.y delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/glslang_tab.cpp.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/intermOut.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/iomapper.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/iomapper.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/limits.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/linkValidate.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/localintermediate.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/parseConst.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/parseVersions.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/pch.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/preprocessor/PpContext.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/propagateNoContraction.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/propagateNoContraction.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/reflection.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/MachineIndependent/reflection.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Unix/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Unix/ossource.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Web/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Web/glslang.after.js delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Web/glslang.js.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Web/glslang.pre.js delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Windows/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Windows/main.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/Windows/ossource.cpp delete mode 100644 lib/shaderc/third_party/glslang/glslang/OSDependent/osinclude.h delete mode 100644 lib/shaderc/third_party/glslang/glslang/Public/ShaderLang.h delete mode 100755 lib/shaderc/third_party/glslang/glslang/updateGrammar delete mode 100644 lib/shaderc/third_party/glslang/hlsl/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/glslang/hlsl/stub.cpp delete mode 100644 lib/shaderc/third_party/glslang/known_good.json delete mode 100644 lib/shaderc/third_party/glslang/known_good_khr.json delete mode 100644 lib/shaderc/third_party/glslang/license-checker.cfg delete mode 100644 lib/shaderc/third_party/glslang/parse_version.cmake delete mode 100644 lib/shaderc/third_party/glslang/standalone.gclient delete mode 100755 lib/shaderc/third_party/glslang/update_glslang_sources.py delete mode 100755 lib/shaderc/third_party/re2/.github/bazel.sh delete mode 100755 lib/shaderc/third_party/re2/.github/cmake.sh delete mode 100644 lib/shaderc/third_party/re2/.github/workflows/ci-bazel.yml delete mode 100644 lib/shaderc/third_party/re2/.github/workflows/ci-cmake.yml delete mode 100644 lib/shaderc/third_party/re2/.github/workflows/ci.yml delete mode 100644 lib/shaderc/third_party/re2/AUTHORS delete mode 100644 lib/shaderc/third_party/re2/BUILD delete mode 100644 lib/shaderc/third_party/re2/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/re2/CONTRIBUTING.md delete mode 100644 lib/shaderc/third_party/re2/CONTRIBUTORS delete mode 100644 lib/shaderc/third_party/re2/LICENSE delete mode 100644 lib/shaderc/third_party/re2/Makefile delete mode 100644 lib/shaderc/third_party/re2/README delete mode 100644 lib/shaderc/third_party/re2/WORKSPACE delete mode 100644 lib/shaderc/third_party/re2/benchlog/benchlog.c2 delete mode 100644 lib/shaderc/third_party/re2/benchlog/benchlog.mini delete mode 100644 lib/shaderc/third_party/re2/benchlog/benchlog.r70 delete mode 100644 lib/shaderc/third_party/re2/benchlog/benchlog.wreck delete mode 100755 lib/shaderc/third_party/re2/benchlog/benchplot.py delete mode 100755 lib/shaderc/third_party/re2/benchlog/mktable delete mode 100755 lib/shaderc/third_party/re2/lib/git/commit-msg.hook delete mode 100644 lib/shaderc/third_party/re2/libre2.symbols delete mode 100644 lib/shaderc/third_party/re2/libre2.symbols.darwin delete mode 100644 lib/shaderc/third_party/re2/re2.pc delete mode 100644 lib/shaderc/third_party/re2/re2/bitmap256.h delete mode 100644 lib/shaderc/third_party/re2/re2/bitstate.cc delete mode 100644 lib/shaderc/third_party/re2/re2/compile.cc delete mode 100644 lib/shaderc/third_party/re2/re2/dfa.cc delete mode 100644 lib/shaderc/third_party/re2/re2/filtered_re2.cc delete mode 100644 lib/shaderc/third_party/re2/re2/filtered_re2.h delete mode 100644 lib/shaderc/third_party/re2/re2/fuzzing/compiler-rt/LICENSE delete mode 100644 lib/shaderc/third_party/re2/re2/fuzzing/compiler-rt/include/fuzzer/FuzzedDataProvider.h delete mode 100644 lib/shaderc/third_party/re2/re2/fuzzing/re2_fuzzer.cc delete mode 100755 lib/shaderc/third_party/re2/re2/make_perl_groups.pl delete mode 100755 lib/shaderc/third_party/re2/re2/make_unicode_casefold.py delete mode 100755 lib/shaderc/third_party/re2/re2/make_unicode_groups.py delete mode 100644 lib/shaderc/third_party/re2/re2/mimics_pcre.cc delete mode 100644 lib/shaderc/third_party/re2/re2/nfa.cc delete mode 100644 lib/shaderc/third_party/re2/re2/onepass.cc delete mode 100644 lib/shaderc/third_party/re2/re2/parse.cc delete mode 100644 lib/shaderc/third_party/re2/re2/perl_groups.cc delete mode 100644 lib/shaderc/third_party/re2/re2/pod_array.h delete mode 100644 lib/shaderc/third_party/re2/re2/prefilter.cc delete mode 100644 lib/shaderc/third_party/re2/re2/prefilter.h delete mode 100644 lib/shaderc/third_party/re2/re2/prefilter_tree.cc delete mode 100644 lib/shaderc/third_party/re2/re2/prefilter_tree.h delete mode 100644 lib/shaderc/third_party/re2/re2/prog.cc delete mode 100644 lib/shaderc/third_party/re2/re2/prog.h delete mode 100644 lib/shaderc/third_party/re2/re2/re2.cc delete mode 100644 lib/shaderc/third_party/re2/re2/re2.h delete mode 100644 lib/shaderc/third_party/re2/re2/regexp.cc delete mode 100644 lib/shaderc/third_party/re2/re2/regexp.h delete mode 100644 lib/shaderc/third_party/re2/re2/set.cc delete mode 100644 lib/shaderc/third_party/re2/re2/set.h delete mode 100644 lib/shaderc/third_party/re2/re2/simplify.cc delete mode 100644 lib/shaderc/third_party/re2/re2/sparse_array.h delete mode 100644 lib/shaderc/third_party/re2/re2/sparse_set.h delete mode 100644 lib/shaderc/third_party/re2/re2/stringpiece.cc delete mode 100644 lib/shaderc/third_party/re2/re2/stringpiece.h delete mode 100644 lib/shaderc/third_party/re2/re2/tostring.cc delete mode 100644 lib/shaderc/third_party/re2/re2/unicode.py delete mode 100644 lib/shaderc/third_party/re2/re2/unicode_casefold.cc delete mode 100644 lib/shaderc/third_party/re2/re2/unicode_casefold.h delete mode 100644 lib/shaderc/third_party/re2/re2/unicode_groups.cc delete mode 100644 lib/shaderc/third_party/re2/re2/unicode_groups.h delete mode 100644 lib/shaderc/third_party/re2/re2/walker-inl.h delete mode 100755 lib/shaderc/third_party/re2/runtests delete mode 100644 lib/shaderc/third_party/re2/testinstall.cc delete mode 100644 lib/shaderc/third_party/re2/ucs2.diff delete mode 100644 lib/shaderc/third_party/re2/util/benchmark.cc delete mode 100644 lib/shaderc/third_party/re2/util/benchmark.h delete mode 100644 lib/shaderc/third_party/re2/util/flags.h delete mode 100644 lib/shaderc/third_party/re2/util/fuzz.cc delete mode 100644 lib/shaderc/third_party/re2/util/logging.h delete mode 100644 lib/shaderc/third_party/re2/util/malloc_counter.h delete mode 100644 lib/shaderc/third_party/re2/util/mix.h delete mode 100644 lib/shaderc/third_party/re2/util/mutex.h delete mode 100644 lib/shaderc/third_party/re2/util/pcre.cc delete mode 100644 lib/shaderc/third_party/re2/util/pcre.h delete mode 100644 lib/shaderc/third_party/re2/util/rune.cc delete mode 100644 lib/shaderc/third_party/re2/util/strutil.cc delete mode 100644 lib/shaderc/third_party/re2/util/strutil.h delete mode 100644 lib/shaderc/third_party/re2/util/test.cc delete mode 100644 lib/shaderc/third_party/re2/util/test.h delete mode 100644 lib/shaderc/third_party/re2/util/utf.h delete mode 100644 lib/shaderc/third_party/re2/util/util.h delete mode 100644 lib/shaderc/third_party/spirv-headers/.gitattributes delete mode 100644 lib/shaderc/third_party/spirv-headers/.github/workflows/presubmit.yml delete mode 100644 lib/shaderc/third_party/spirv-headers/BUILD.bazel delete mode 100644 lib/shaderc/third_party/spirv-headers/BUILD.gn delete mode 100644 lib/shaderc/third_party/spirv-headers/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-headers/CODE_OF_CONDUCT.md delete mode 100644 lib/shaderc/third_party/spirv-headers/LICENSE delete mode 100644 lib/shaderc/third_party/spirv-headers/README.md delete mode 100644 lib/shaderc/third_party/spirv-headers/SPIRV-Headers.pc.in delete mode 100644 lib/shaderc/third_party/spirv-headers/WORKSPACE delete mode 100644 lib/shaderc/third_party/spirv-headers/cmake/Config.cmake.in delete mode 100644 lib/shaderc/third_party/spirv-headers/example/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-headers/example/example.cpp delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/GLSL.std.450.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/OpenCL.std.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/extinst.opencl.std.100.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/spirv.core.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/spirv.cs delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/spirv.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/spirv.hpp delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/spirv.hpp11 delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/spirv.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/spirv.lua delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.0/spirv.py delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/GLSL.std.450.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/OpenCL.std.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/extinst.glsl.std.450.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/extinst.opencl.std.100.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/spirv.core.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/spirv.cs delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/spirv.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/spirv.hpp delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/spirv.hpp11 delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/spirv.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/spirv.lua delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.1/spirv.py delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/GLSL.std.450.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/OpenCL.std.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/extinst.glsl.std.450.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/extinst.opencl.std.100.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/spirv.core.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/spirv.cs delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/spirv.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/spirv.hpp delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/spirv.hpp11 delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/spirv.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/spirv.lua delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/1.2/spirv.py delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/spir-v.xml delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/AMD_gcn_shader.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/AMD_shader_ballot.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/AMD_shader_explicit_vertex_parameter.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/AMD_shader_trinary_minmax.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/DebugInfo.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/GLSL.std.450.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/NonSemanticClspvReflection.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/NonSemanticDebugPrintf.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/NonSemanticShaderDebugInfo100.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/OpenCL.std.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/OpenCLDebugInfo100.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.debuginfo.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.glsl.std.450.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.nonsemantic.clspvreflection.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.nonsemantic.debugprintf.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.nonsemantic.shader.debuginfo.100.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.debuginfo.100.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.opencl.std.100.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.spv-amd-gcn-shader.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.spv-amd-shader-ballot.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/extinst.spv-amd-shader-trinary-minmax.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spirv.core.grammar.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spirv.cs delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spirv.h delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spirv.hpp delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spirv.hpp11 delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spirv.json delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spirv.lua delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spirv.py delete mode 100644 lib/shaderc/third_party/spirv-headers/include/spirv/unified1/spv.d delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/CMakeLists.txt delete mode 100755 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/bin/generate_language_headers.py delete mode 100755 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/bin/makeExtinstHeaders.py delete mode 100755 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/bin/makeHeaders delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/header.cpp delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/header.h delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/jsonToSpirv.cpp delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/jsonToSpirv.h delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/jsoncpp/dist/json/json-forwards.h delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/jsoncpp/dist/json/json.h delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/jsoncpp/dist/jsoncpp.cpp delete mode 100644 lib/shaderc/third_party/spirv-headers/tools/buildHeaders/main.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/.clang-format delete mode 100644 lib/shaderc/third_party/spirv-tools/.github/workflows/wasm.yml delete mode 100644 lib/shaderc/third_party/spirv-tools/.gn delete mode 100644 lib/shaderc/third_party/spirv-tools/Android.mk delete mode 100644 lib/shaderc/third_party/spirv-tools/BUILD.bazel delete mode 100644 lib/shaderc/third_party/spirv-tools/BUILD.gn delete mode 100644 lib/shaderc/third_party/spirv-tools/CHANGES delete mode 100644 lib/shaderc/third_party/spirv-tools/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/CODE_OF_CONDUCT.md delete mode 100644 lib/shaderc/third_party/spirv-tools/CONTRIBUTING.md delete mode 100644 lib/shaderc/third_party/spirv-tools/DEPS delete mode 100644 lib/shaderc/third_party/spirv-tools/LICENSE delete mode 100644 lib/shaderc/third_party/spirv-tools/PRESUBMIT.py delete mode 100644 lib/shaderc/third_party/spirv-tools/README.md delete mode 100644 lib/shaderc/third_party/spirv-tools/WORKSPACE delete mode 100644 lib/shaderc/third_party/spirv-tools/android_test/Android.mk delete mode 100644 lib/shaderc/third_party/spirv-tools/android_test/jni/Application.mk delete mode 100644 lib/shaderc/third_party/spirv-tools/android_test/test.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/build_defs.bzl delete mode 100644 lib/shaderc/third_party/spirv-tools/build_overrides/build.gni delete mode 100644 lib/shaderc/third_party/spirv-tools/build_overrides/gtest.gni delete mode 100644 lib/shaderc/third_party/spirv-tools/build_overrides/spirv_tools.gni delete mode 100644 lib/shaderc/third_party/spirv-tools/cmake/SPIRV-Tools-shared.pc.in delete mode 100644 lib/shaderc/third_party/spirv-tools/cmake/SPIRV-Tools.pc.in delete mode 100644 lib/shaderc/third_party/spirv-tools/cmake/write_pkg_config.cmake delete mode 100644 lib/shaderc/third_party/spirv-tools/codereview.settings delete mode 100644 lib/shaderc/third_party/spirv-tools/docker-compose.yml delete mode 100644 lib/shaderc/third_party/spirv-tools/docs/downloads.md delete mode 100644 lib/shaderc/third_party/spirv-tools/docs/projects.md delete mode 100644 lib/shaderc/third_party/spirv-tools/docs/spirv-fuzz.md delete mode 100644 lib/shaderc/third_party/spirv-tools/docs/syntax.md delete mode 100644 lib/shaderc/third_party/spirv-tools/external/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/include/spirv-tools/instrument.hpp delete mode 100644 lib/shaderc/third_party/spirv-tools/include/spirv-tools/libspirv.h delete mode 100644 lib/shaderc/third_party/spirv-tools/include/spirv-tools/libspirv.hpp delete mode 100644 lib/shaderc/third_party/spirv-tools/include/spirv-tools/linker.hpp delete mode 100644 lib/shaderc/third_party/spirv-tools/include/spirv-tools/linter.hpp delete mode 100644 lib/shaderc/third_party/spirv-tools/include/spirv-tools/optimizer.hpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/source/assembly_grammar.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/assembly_grammar.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/binary.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/binary.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/cfa.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/common_debug_info.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/diagnostic.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/diagnostic.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/disassemble.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/disassemble.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/enum_set.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/enum_string_mapping.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/enum_string_mapping.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/ext_inst.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/ext_inst.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/extensions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/extensions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/added_function_reducer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/added_function_reducer.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/available_instructions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/available_instructions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/call_graph.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/call_graph.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/comparator_deep_blocks_first.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/counter_overflow_id_source.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/counter_overflow_id_source.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/data_descriptor.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/data_descriptor.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/equivalence_relation.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/constant_uniform_facts.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/constant_uniform_facts.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/data_synonym_and_id_equation_facts.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/data_synonym_and_id_equation_facts.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/dead_block_facts.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/dead_block_facts.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/fact_manager.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/fact_manager.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/irrelevant_value_facts.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/irrelevant_value_facts.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/livesafe_function_facts.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fact_manager/livesafe_function_facts.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/force_render_red.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/force_render_red.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_context.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_context.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_access_chains.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_access_chains.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_bit_instruction_synonyms.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_bit_instruction_synonyms.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_composite_extract.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_composite_extract.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_composite_inserts.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_composite_inserts.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_composite_types.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_composite_types.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_copy_memory.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_copy_memory.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_dead_blocks.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_dead_blocks.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_dead_breaks.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_dead_breaks.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_dead_continues.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_dead_continues.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_equation_instructions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_equation_instructions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_function_calls.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_function_calls.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_global_variables.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_global_variables.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_image_sample_unused_components.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_image_sample_unused_components.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_loads.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_loads.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_local_variables.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_local_variables.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_loop_preheaders.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_loop_preheaders.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_loops_to_create_int_constant_synonyms.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_loops_to_create_int_constant_synonyms.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_no_contraction_decorations.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_no_contraction_decorations.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_opphi_synonyms.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_opphi_synonyms.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_parameters.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_parameters.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_relaxed_decorations.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_relaxed_decorations.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_stores.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_stores.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_synonyms.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_synonyms.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_vector_shuffle_instructions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_add_vector_shuffle_instructions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_branch_weights.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_branch_weights.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_function_controls.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_function_controls.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_loop_controls.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_loop_controls.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_memory_operands_masks.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_memory_operands_masks.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_selection_controls.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_adjust_selection_controls.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_apply_id_synonyms.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_apply_id_synonyms.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_construct_composites.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_construct_composites.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_copy_objects.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_copy_objects.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_donate_modules.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_donate_modules.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_duplicate_regions_with_selections.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_duplicate_regions_with_selections.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_expand_vector_reductions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_expand_vector_reductions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_flatten_conditional_branches.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_flatten_conditional_branches.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_inline_functions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_inline_functions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_interchange_signedness_of_integer_operands.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_interchange_signedness_of_integer_operands.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_interchange_zero_like_constants.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_interchange_zero_like_constants.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_invert_comparison_operators.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_invert_comparison_operators.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_make_vector_operations_dynamic.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_make_vector_operations_dynamic.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_merge_blocks.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_merge_blocks.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_merge_function_returns.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_merge_function_returns.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_mutate_pointers.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_mutate_pointers.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_obfuscate_constants.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_obfuscate_constants.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_outline_functions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_outline_functions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_blocks.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_blocks.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_function_parameters.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_function_parameters.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_function_variables.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_function_variables.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_instructions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_instructions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_phi_operands.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_permute_phi_operands.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_propagate_instructions_down.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_propagate_instructions_down.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_propagate_instructions_up.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_propagate_instructions_up.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_push_ids_through_variables.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_push_ids_through_variables.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_adds_subs_muls_with_carrying_extended.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_adds_subs_muls_with_carrying_extended.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_branches_from_dead_blocks_with_exits.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_branches_from_dead_blocks_with_exits.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_copy_memories_with_loads_stores.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_copy_memories_with_loads_stores.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_copy_objects_with_stores_loads.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_copy_objects_with_stores_loads.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_irrelevant_ids.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_irrelevant_ids.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_linear_algebra_instructions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_linear_algebra_instructions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_loads_stores_with_copy_memories.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_loads_stores_with_copy_memories.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_opphi_ids_from_dead_predecessors.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_opphi_ids_from_dead_predecessors.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_opselects_with_conditional_branches.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_opselects_with_conditional_branches.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_parameter_with_global.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_parameter_with_global.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_params_with_struct.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_replace_params_with_struct.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_split_blocks.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_split_blocks.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_swap_commutable_operands.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_swap_commutable_operands.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_swap_conditional_branch_operands.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_swap_conditional_branch_operands.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_swap_functions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_swap_functions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_toggle_access_chain_instruction.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_toggle_access_chain_instruction.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_wrap_regions_in_selections.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_wrap_regions_in_selections.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_wrap_vector_synonym.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_pass_wrap_vector_synonym.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_util.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/fuzzer_util.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/id_use_descriptor.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/id_use_descriptor.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/instruction_descriptor.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/instruction_descriptor.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/instruction_message.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/instruction_message.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/overflow_id_source.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/overflow_id_source.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_instances.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_manager.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_manager.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_manager_looped_with_recommendations.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_manager_looped_with_recommendations.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_manager_random_with_recommendations.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_manager_random_with_recommendations.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_manager_simple.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_manager_simple.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_recommender.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_recommender.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_recommender_standard.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pass_management/repeated_pass_recommender_standard.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/protobufs/spirvfuzz_protobufs.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/protobufs/spvtoolsfuzz.proto delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pseudo_random_generator.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/pseudo_random_generator.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/random_generator.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/random_generator.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/replayer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/replayer.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/shrinker.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/shrinker.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_access_chain.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_access_chain.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_bit_instruction_synonym.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_bit_instruction_synonym.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_constant_boolean.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_constant_boolean.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_constant_composite.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_constant_composite.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_constant_null.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_constant_null.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_constant_scalar.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_constant_scalar.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_copy_memory.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_copy_memory.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_dead_block.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_dead_block.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_dead_break.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_dead_break.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_dead_continue.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_dead_continue.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_early_terminator_wrapper.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_early_terminator_wrapper.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_function.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_function.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_global_undef.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_global_undef.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_global_variable.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_global_variable.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_image_sample_unused_components.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_image_sample_unused_components.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_local_variable.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_local_variable.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_loop_preheader.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_loop_preheader.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_loop_to_create_int_constant_synonym.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_loop_to_create_int_constant_synonym.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_no_contraction_decoration.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_no_contraction_decoration.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_opphi_synonym.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_opphi_synonym.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_parameter.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_parameter.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_relaxed_decoration.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_relaxed_decoration.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_spec_constant_op.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_spec_constant_op.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_synonym.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_synonym.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_array.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_array.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_boolean.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_boolean.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_float.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_float.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_function.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_function.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_int.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_int.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_matrix.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_matrix.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_pointer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_pointer.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_struct.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_struct.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_vector.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_add_type_vector.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_adjust_branch_weights.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_adjust_branch_weights.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_composite_construct.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_composite_construct.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_composite_extract.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_composite_extract.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_composite_insert.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_composite_insert.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_compute_data_synonym_fact_closure.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_compute_data_synonym_fact_closure.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_context.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_context.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_duplicate_region_with_selection.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_duplicate_region_with_selection.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_equation_instruction.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_equation_instruction.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_expand_vector_reduction.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_expand_vector_reduction.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_flatten_conditional_branch.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_flatten_conditional_branch.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_function_call.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_function_call.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_inline_function.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_inline_function.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_invert_comparison_operator.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_invert_comparison_operator.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_load.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_load.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_make_vector_operation_dynamic.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_make_vector_operation_dynamic.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_merge_blocks.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_merge_blocks.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_merge_function_returns.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_merge_function_returns.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_move_block_down.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_move_block_down.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_move_instruction_down.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_move_instruction_down.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_mutate_pointer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_mutate_pointer.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_outline_function.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_outline_function.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_permute_function_parameters.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_permute_function_parameters.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_permute_phi_operands.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_permute_phi_operands.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_propagate_instruction_down.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_propagate_instruction_down.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_propagate_instruction_up.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_propagate_instruction_up.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_push_id_through_variable.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_push_id_through_variable.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_record_synonymous_constants.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_record_synonymous_constants.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_add_sub_mul_with_carrying_extended.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_add_sub_mul_with_carrying_extended.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_boolean_constant_with_constant_binary.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_boolean_constant_with_constant_binary.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_branch_from_dead_block_with_exit.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_branch_from_dead_block_with_exit.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_constant_with_uniform.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_constant_with_uniform.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_copy_memory_with_load_store.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_copy_memory_with_load_store.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_copy_object_with_store_load.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_copy_object_with_store_load.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_id_with_synonym.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_id_with_synonym.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_irrelevant_id.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_irrelevant_id.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_linear_algebra_instruction.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_linear_algebra_instruction.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_load_store_with_copy_memory.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_load_store_with_copy_memory.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_opphi_id_from_dead_predecessor.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_opphi_id_from_dead_predecessor.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_opselect_with_conditional_branch.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_opselect_with_conditional_branch.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_parameter_with_global.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_parameter_with_global.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_params_with_struct.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_replace_params_with_struct.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_set_function_control.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_set_function_control.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_set_loop_control.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_set_loop_control.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_set_memory_operands_mask.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_set_memory_operands_mask.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_set_selection_control.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_set_selection_control.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_split_block.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_split_block.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_store.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_store.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_swap_commutable_operands.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_swap_commutable_operands.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_swap_conditional_branch_operands.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_swap_conditional_branch_operands.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_swap_function_variables.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_swap_function_variables.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_swap_two_functions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_swap_two_functions.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_toggle_access_chain_instruction.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_toggle_access_chain_instruction.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_vector_shuffle.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_vector_shuffle.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_wrap_early_terminator_in_function.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_wrap_early_terminator_in_function.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_wrap_region_in_selection.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_wrap_region_in_selection.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_wrap_vector_synonym.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/transformation_wrap_vector_synonym.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/uniform_buffer_element_descriptor.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/fuzz/uniform_buffer_element_descriptor.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/instruction.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/latest_version_glsl_std_450_header.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/latest_version_opencl_std_header.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/latest_version_spirv_header.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/libspirv.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/link/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/source/link/linker.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/lint/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/source/lint/divergence_analysis.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/lint/divergence_analysis.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/lint/lint_divergent_derivatives.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/lint/linter.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/lint/lints.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/macro.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/name_mapper.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/name_mapper.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opcode.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opcode.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/operand.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/operand.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/aggressive_dead_code_elim_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/amd_ext_to_khr.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/amd_ext_to_khr.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/basic_block.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/basic_block.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/block_merge_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/block_merge_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/block_merge_util.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/block_merge_util.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/build_module.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/build_module.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ccp_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ccp_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/cfg.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/cfg.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/cfg_cleanup_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/cfg_cleanup_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/code_sink.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/code_sink.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/combine_access_chains.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/combine_access_chains.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/compact_ids_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/compact_ids_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/composite.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/composite.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/const_folding_rules.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/const_folding_rules.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/constants.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/constants.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/control_dependence.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/control_dependence.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/convert_to_half_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/convert_to_half_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/convert_to_sampled_image_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/convert_to_sampled_image_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/copy_prop_arrays.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/copy_prop_arrays.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dataflow.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dataflow.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dead_branch_elim_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dead_branch_elim_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dead_insert_elim_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dead_insert_elim_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dead_variable_elimination.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dead_variable_elimination.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/debug_info_manager.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/debug_info_manager.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/decoration_manager.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/decoration_manager.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/def_use_manager.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/def_use_manager.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/desc_sroa.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/desc_sroa.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/desc_sroa_util.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/desc_sroa_util.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dominator_analysis.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dominator_analysis.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dominator_tree.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/dominator_tree.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/eliminate_dead_constant_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/eliminate_dead_functions_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/eliminate_dead_functions_util.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/eliminate_dead_functions_util.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/eliminate_dead_members_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/eliminate_dead_members_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/empty_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/feature_manager.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/feature_manager.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/fix_storage_class.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/fix_storage_class.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/flatten_decoration_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/flatten_decoration_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/fold.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/fold.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/folding_rules.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/folding_rules.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/freeze_spec_constant_value_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/function.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/function.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/graphics_robust_access_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/graphics_robust_access_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/if_conversion.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/if_conversion.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inline_exhaustive_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inline_exhaustive_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inline_opaque_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inline_opaque_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inline_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inline_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inst_bindless_check_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inst_bindless_check_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inst_buff_addr_check_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inst_buff_addr_check_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inst_debug_printf_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/inst_debug_printf_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/instruction.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/instruction.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/instruction_list.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/instruction_list.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/instrument_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/instrument_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/interp_fixup_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/interp_fixup_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ir_builder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ir_context.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ir_context.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ir_loader.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ir_loader.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/iterator.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/licm_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/licm_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/local_access_chain_convert_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/local_redundancy_elimination.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/local_redundancy_elimination.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/local_single_block_elim_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/local_single_block_elim_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/local_single_store_elim_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/local_single_store_elim_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/log.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_dependence.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_dependence.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_dependence_helpers.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_descriptor.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_descriptor.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_fission.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_fission.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_fusion.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_fusion.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_fusion_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_fusion_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_peeling.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_peeling.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_unroller.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_unroller.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_unswitch_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_unswitch_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_utils.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/loop_utils.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/mem_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/mem_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/merge_return_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/merge_return_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/module.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/module.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/null_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/optimizer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/pass_manager.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/pass_manager.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/passes.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/pch_source_opt.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/pch_source_opt.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/private_to_local_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/private_to_local_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/propagator.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/propagator.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/reduce_load_size.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/reduce_load_size.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/redundancy_elimination.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/redundancy_elimination.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/reflect.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/register_pressure.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/register_pressure.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/relax_float_ops_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/relax_float_ops_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/remove_duplicates_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/remove_duplicates_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/remove_unused_interface_variables_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/remove_unused_interface_variables_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/replace_desc_array_access_using_var_index.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/replace_invalid_opc.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/replace_invalid_opc.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/scalar_analysis.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/scalar_analysis.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/scalar_analysis_nodes.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/scalar_analysis_simplification.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/scalar_replacement_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/scalar_replacement_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/set_spec_constant_default_value_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/simplification_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/simplification_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/spread_volatile_semantics.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/spread_volatile_semantics.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ssa_rewrite_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/ssa_rewrite_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/strength_reduction_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/strength_reduction_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/strip_debug_info_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/strip_debug_info_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/strip_nonsemantic_info_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/strip_nonsemantic_info_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/struct_cfg_analysis.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/struct_cfg_analysis.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/tree_iterator.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/type_manager.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/type_manager.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/types.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/types.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/unify_const_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/unify_const_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/upgrade_memory_model.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/upgrade_memory_model.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/value_number_table.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/value_number_table.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/vector_dce.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/vector_dce.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/workaround1209.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/workaround1209.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/wrap_opkill.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/opt/wrap_opkill.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/parsed_operand.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/parsed_operand.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/pch_source.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/pch_source.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/print.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/print.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/change_operand_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/change_operand_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/change_operand_to_undef_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/change_operand_to_undef_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/conditional_branch_to_simple_conditional_branch_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/conditional_branch_to_simple_conditional_branch_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/conditional_branch_to_simple_conditional_branch_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/operand_to_const_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/operand_to_const_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/operand_to_dominating_id_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/operand_to_dominating_id_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/operand_to_undef_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/operand_to_undef_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/pch_source_reduce.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/pch_source_reduce.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reducer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reducer.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reduction_pass.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reduction_pass.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reduction_util.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/reduction_util.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_block_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_block_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_block_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_block_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_function_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_function_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_function_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_function_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_instruction_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_instruction_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_selection_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_selection_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_selection_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_selection_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_struct_member_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_struct_member_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_unused_instruction_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_unused_instruction_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_unused_struct_member_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/remove_unused_struct_member_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/simple_conditional_branch_to_branch_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/simple_conditional_branch_to_branch_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/simple_conditional_branch_to_branch_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/structured_construct_to_block_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/structured_construct_to_block_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/structured_construct_to_block_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/structured_construct_to_block_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/structured_loop_to_selection_reduction_opportunity.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/structured_loop_to_selection_reduction_opportunity.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/structured_loop_to_selection_reduction_opportunity_finder.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/reduce/structured_loop_to_selection_reduction_opportunity_finder.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/software_version.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_constant.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_definition.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_endian.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_endian.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_fuzzer_options.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_fuzzer_options.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_optimizer_options.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_optimizer_options.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_reducer_options.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_reducer_options.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_target_env.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_target_env.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_validator_options.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/spirv_validator_options.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/table.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/table.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/text.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/text.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/text_handler.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/text_handler.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/bit_vector.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/bit_vector.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/bitutils.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/hex_float.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/ilist.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/ilist_node.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/make_unique.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/parse_number.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/parse_number.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/small_vector.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/string_utils.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/string_utils.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/timer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/util/timer.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/basic_block.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/basic_block.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/construct.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/construct.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/decoration.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/function.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/function.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/instruction.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/instruction.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_adjacency.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_annotation.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_arithmetics.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_atomics.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_barriers.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_bitwise.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_builtins.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_capability.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_cfg.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_composites.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_constants.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_conversion.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_debug.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_decorations.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_derivatives.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_execution_limitations.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_extensions.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_function.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_id.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_image.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_instruction.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_interfaces.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_layout.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_literals.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_logicals.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_memory.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_memory_semantics.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_memory_semantics.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_misc.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_mode_setting.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_non_uniform.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_primitives.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_scopes.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_scopes.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_small_type_uses.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validate_type.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validation_state.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/val/validation_state.h delete mode 100644 lib/shaderc/third_party/spirv-tools/source/wasm/README.md delete mode 100755 lib/shaderc/third_party/spirv-tools/source/wasm/build.sh delete mode 100644 lib/shaderc/third_party/spirv-tools/source/wasm/package.json delete mode 100644 lib/shaderc/third_party/spirv-tools/source/wasm/spirv-tools.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/source/wasm/spirv-tools.d.ts delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/as/as.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/cfg/bin_to_dot.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/cfg/bin_to_dot.h delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/cfg/cfg.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/dis/dis.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/emacs/50spirv-tools.el delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/emacs/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/fuzz/fuzz.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/io.h delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/lesspipe/CMakeLists.txt delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/lesspipe/spirv-lesspipe.sh delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/link/linker.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/lint/lint.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/opt/opt.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/reduce/reduce.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/.eslintrc.json delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/README.md delete mode 100755 lib/shaderc/third_party/spirv-tools/tools/sva/bin/sva.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/mocha.opts delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/package.json delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/rollup.config.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/assembler.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/assembler_test.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/ast.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/lexer.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/lexer_test.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/parser.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/parser_test.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/spirv.data.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/sva.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/src/token.js delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/tests/empty_main.spv_asm delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/tests/index.html delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/tests/simple.spv_asm delete mode 100755 lib/shaderc/third_party/spirv-tools/tools/sva/tools/process_grammar.rb delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/sva/yarn.lock delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/util/cli_consumer.cpp delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/util/cli_consumer.h delete mode 100644 lib/shaderc/third_party/spirv-tools/tools/val/val.cpp delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/check_code_format.sh delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/check_copyright.py delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/check_symbol_exports.py delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/fixup_fuzz_result.py delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/generate_grammar_tables.py delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/generate_language_headers.py delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/generate_registry_tables.py delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/generate_vim_syntax.py delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/git-sync-deps delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/roll_deps.sh delete mode 100755 lib/shaderc/third_party/spirv-tools/utils/update_build_version.py delete mode 100755 lib/shaderc/utils/add_copyright.py delete mode 100755 lib/shaderc/utils/git-sync-deps delete mode 100755 lib/shaderc/utils/remove-file-by-suffix.py delete mode 100755 lib/shaderc/utils/roll-deps delete mode 100755 lib/shaderc/utils/update_build_version.py diff --git a/.gitignore b/.gitignore index 08d4c471c..70be3aea0 100644 --- a/.gitignore +++ b/.gitignore @@ -90,5 +90,6 @@ lib/harfbuzz lib/sdl2 lib/mbedtls lib/astc-encoder +lib/shaderc .DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 67fbd8e5b..2c9387c2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,32 +260,23 @@ if(NOT SERVER_ONLY) endif() if(NOT SERVER_ONLY) - find_library(SHADERC_LIBRARY NAMES shaderc_shared libshaderc_shared) + if (IOS) + find_library(SHADERC_LIBRARY NAMES shaderc_combined libshaderc_combined) + else() + find_library(SHADERC_LIBRARY NAMES shaderc_shared libshaderc_shared) + endif() find_path(SHADERC_INCLUDEDIR NAMES shaderc/shaderc.hpp PATHS) if (NOT SHADERC_LIBRARY OR NOT SHADERC_INCLUDEDIR) - set(SHADERC_SKIP_INSTALL ON CACHE INTERNAL "Skip installation" FORCE) - set(SHADERC_SKIP_TESTS ON CACHE INTERNAL "Skip building tests" FORCE) - set(SHADERC_SKIP_EXAMPLES ON CACHE INTERNAL "Skip building examples" FORCE) - set(SHADERC_SKIP_COPYRIGHT_CHECK ON CACHE INTERNAL "Skip copyright check" FORCE) - - set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE INTERNAL "Skip install" FORCE) - set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE INTERNAL "Skip building examples" FORCE) - - set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE INTERNAL "Skip installation" FORCE) - set(SPIRV_SKIP_TESTS ON CACHE INTERNAL "Skip tests" FORCE) - set(SPIRV_SKIP_EXECUTABLES ON CACHE INTERNAL "Skip executables" FORCE) - - set(ENABLE_GLSLANG_BINARIES OFF CACHE INTERNAL "Builds glslangValidator and spirv-remap" FORCE) - set(ENABLE_CTEST OFF CACHE INTERNAL "Enable ctest" FORCE) - - add_subdirectory("${PROJECT_SOURCE_DIR}/lib/shaderc") - include_directories(BEFORE "${PROJECT_SOURCE_DIR}/lib/shaderc/libshaderc/include") - SET(SHADERC_LIBRARY shaderc) - message(STATUS "System shaderc not found, use the bundled one.") + if (NOT NO_SHADERC) + message(FATAL_ERROR "Please install shaderc from your distribution or disable vulkan support with -DNO_SHADERC=on") + endif() else() include_directories("${SHADERC_INCLUDEDIR}") MESSAGE(STATUS "Use system shaderc: ${SHADERC_LIBRARY}") endif() + if (NO_SHADERC) + add_definitions(-DDISABLE_SHADERC) + endif() add_subdirectory("${PROJECT_SOURCE_DIR}/lib/graphics_engine") endif() @@ -774,8 +765,10 @@ if(NOT SERVER_ONLY) graphics_utils graphics_engine ${SDL2_LIBRARY} - tinygettext - ${SHADERC_LIBRARY}) + tinygettext) + if (NOT NO_SHADERC) + target_link_libraries(supertuxkart ${SHADERC_LIBRARY}) + endif() endif() if(UNIX AND NOT APPLE) diff --git a/cmake/Toolchain-ios-xcode.cmake b/cmake/Toolchain-ios-xcode.cmake index 4a8c80f70..25e52c030 100644 --- a/cmake/Toolchain-ios-xcode.cmake +++ b/cmake/Toolchain-ios-xcode.cmake @@ -61,6 +61,8 @@ set(MOLTENVK_LIBRARY ${PROJECT_SOURCE_DIR}/dependencies\${EFFECTIVE_PLATFORM_NAM set(VULKAN_INCLUDEDIR ${PROJECT_SOURCE_DIR}/dependencies-iphoneos/include CACHE STRING "") set(LIBASTCENC_LIBRARY ${PROJECT_SOURCE_DIR}/dependencies\${EFFECTIVE_PLATFORM_NAME}/lib/libastcenc.a CACHE STRING "") set(LIBASTCENC_INCLUDEDIR ${PROJECT_SOURCE_DIR}/dependencies-iphoneos/include CACHE STRING "") +set(SHADERC_LIBRARY ${PROJECT_SOURCE_DIR}/dependencies\${EFFECTIVE_PLATFORM_NAME}/lib/libshaderc_combined.a CACHE STRING "") +set(SHADERC_INCLUDEDIR ${PROJECT_SOURCE_DIR}/dependencies-iphoneos/include CACHE STRING "") # For universal iOS and simulator set(LIBRESOLV_LIBRARY -lresolv CACHE STRING "") diff --git a/lib/graphics_engine/src/ge_vulkan_shader_manager.cpp b/lib/graphics_engine/src/ge_vulkan_shader_manager.cpp index 587b0ab38..f27d8640b 100644 --- a/lib/graphics_engine/src/ge_vulkan_shader_manager.cpp +++ b/lib/graphics_engine/src/ge_vulkan_shader_manager.cpp @@ -34,6 +34,7 @@ std::map* > g_shaders; } // GEVulkanShaderManager // ============================================================================ +#ifndef DISABLE_SHADERC shaderc_include_result* showError(const char* message) { shaderc_include_result* err = new shaderc_include_result; @@ -44,6 +45,7 @@ shaderc_include_result* showError(const char* message) err->user_data = NULL; return err; } // showError +#endif // ============================================================================ void GEVulkanShaderManager::init(GEVulkanDriver* vk) @@ -90,6 +92,7 @@ void GEVulkanShaderManager::destroy() // ---------------------------------------------------------------------------- void GEVulkanShaderManager::loadAllShaders() { +#ifndef DISABLE_SHADERC irr::io::IFileList* files = g_file_system->createFileList( getShaderFolder().c_str()); for (unsigned i = 0; i < files->getFileCount(); i++) @@ -122,12 +125,16 @@ void GEVulkanShaderManager::loadAllShaders() }); } files->drop(); +#endif } // loadAllShaders // ---------------------------------------------------------------------------- VkShaderModule GEVulkanShaderManager::loadShader(shaderc_shader_kind kind, const std::string& name) { +#ifdef DISABLE_SHADERC + return VK_NULL_HANDLE; +#else std::string shader_fullpath = getShaderFolder() + name; irr::io::IReadFile* r = irr::io::createReadFile(shader_fullpath.c_str()); if (!r) @@ -238,6 +245,7 @@ VkShaderModule GEVulkanShaderManager::loadShader(shaderc_shader_kind kind, shaderc_result_release(result); shaderc_compiler_release(compiler); return shader_module; +#endif } // loadShader // ---------------------------------------------------------------------------- diff --git a/lib/graphics_engine/src/ge_vulkan_shader_manager.hpp b/lib/graphics_engine/src/ge_vulkan_shader_manager.hpp index 360ede6d0..c2f01b92c 100644 --- a/lib/graphics_engine/src/ge_vulkan_shader_manager.hpp +++ b/lib/graphics_engine/src/ge_vulkan_shader_manager.hpp @@ -3,7 +3,11 @@ #include "vulkan_wrapper.h" #include -#include +#ifdef DISABLE_SHADERC + #define shaderc_shader_kind int +#else + #include +#endif namespace GE { diff --git a/lib/shaderc/.clang-format b/lib/shaderc/.clang-format deleted file mode 100644 index e209e8cb8..000000000 --- a/lib/shaderc/.clang-format +++ /dev/null @@ -1,5 +0,0 @@ ---- -# Use Google code formatting rules. -Language: Cpp -BasedOnStyle: Google -... diff --git a/lib/shaderc/AUTHORS b/lib/shaderc/AUTHORS deleted file mode 100644 index 9bd9eaa7b..000000000 --- a/lib/shaderc/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -# This is the official list of shaderc authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS files. -# See the latter for an explanation. - -# Names should be added to this file as: -# Name or Organization -# The email address is not required for organizations. - -Google Inc. diff --git a/lib/shaderc/Android.mk b/lib/shaderc/Android.mk deleted file mode 100644 index 147d95934..000000000 --- a/lib/shaderc/Android.mk +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ROOT_SHADERC_PATH := $(call my-dir) - -include $(ROOT_SHADERC_PATH)/third_party/Android.mk -include $(ROOT_SHADERC_PATH)/libshaderc_util/Android.mk -include $(ROOT_SHADERC_PATH)/libshaderc/Android.mk - -ALL_LIBS:=libglslang.a \ - libOGLCompiler.a \ - libOSDependent.a \ - libshaderc.a \ - libshaderc_util.a \ - libSPIRV.a \ - libHLSL.a \ - libSPIRV-Tools.a \ - libSPIRV-Tools-opt.a - -SHADERC_HEADERS=shaderc.hpp shaderc.h env.h status.h visibility.h -SHADERC_HEADERS_IN_OUT_DIR=$(foreach H,$(SHADERC_HEADERS),$(NDK_APP_LIBS_OUT)/../include/shaderc/$(H)) - -define gen_libshaderc_header -$(NDK_APP_LIBS_OUT)/../include/shaderc/$(1) : \ - $(ROOT_SHADERC_PATH)/libshaderc/include/shaderc/$(1) - $(call host-mkdir,$(NDK_APP_LIBS_OUT)/../include/shaderc) - $(call host-cp,$(ROOT_SHADERC_PATH)/libshaderc/include/shaderc/$(1) \ - ,$(NDK_APP_LIBS_OUT)/../include/shaderc/$(1)) - -endef - -define gen_libshaderc - -$(1)/combine.ar: $(addprefix $(1)/, $(ALL_LIBS)) - @echo "create libshaderc_combined.a" > $(1)/combine.ar - $(foreach lib,$(ALL_LIBS), - @echo "addlib $(lib)" >> $(1)/combine.ar - ) - @echo "save" >> $(1)/combine.ar - @echo "end" >> $(1)/combine.ar - -$(1)/libshaderc_combined.a: $(addprefix $(1)/, $(ALL_LIBS)) $(1)/combine.ar - @echo "[$(TARGET_ARCH_ABI)] Combine: libshaderc_combined.a <= $(ALL_LIBS)" - @cd $(1) && $(TARGET_AR) -M < combine.ar && cd $(ROOT_SHADERC_PATH) - @$(TARGET_STRIP) --strip-debug $(1)/libshaderc_combined.a - -$(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI)/libshaderc.a: \ - $(1)/libshaderc_combined.a - $(call host-mkdir,$(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI)) - $(call host-cp,$(1)/libshaderc_combined.a \ - ,$(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI)/libshaderc.a) - -ifndef HEADER_TARGET -HEADER_TARGET=1 -$(eval $(foreach H,$(SHADERC_HEADERS),$(call gen_libshaderc_header,$(H)))) -endif - -libshaderc_combined: \ - $(NDK_APP_LIBS_OUT)/$(APP_STL)/$(TARGET_ARCH_ABI)/libshaderc.a - -endef - -libshaderc_combined: $(SHADERC_HEADERS_IN_OUT_DIR) - -$(eval $(call gen_libshaderc,$(TARGET_OUT))) diff --git a/lib/shaderc/BUILD.gn b/lib/shaderc/BUILD.gn deleted file mode 100644 index 9fb5fb7ac..000000000 --- a/lib/shaderc/BUILD.gn +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright 2018 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/build.gni") -import("//build_overrides/shaderc.gni") - -glslang_dir = shaderc_glslang_dir -spirv_tools_dir = shaderc_spirv_tools_dir - -config("shaderc_util_public") { - include_dirs = [ "libshaderc_util/include" ] -} - -source_set("shaderc_util_sources") { - sources = [ - "libshaderc_util/include/libshaderc_util/counting_includer.h", - "libshaderc_util/include/libshaderc_util/exceptions.h", - "libshaderc_util/include/libshaderc_util/file_finder.h", - "libshaderc_util/include/libshaderc_util/format.h", - "libshaderc_util/include/libshaderc_util/io_shaderc.h", - "libshaderc_util/include/libshaderc_util/message.h", - "libshaderc_util/include/libshaderc_util/mutex.h", - "libshaderc_util/include/libshaderc_util/resources.h", - "libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h", - "libshaderc_util/include/libshaderc_util/string_piece.h", - "libshaderc_util/include/libshaderc_util/universal_unistd.h", - "libshaderc_util/include/libshaderc_util/version_profile.h", - "libshaderc_util/src/compiler.cc", - "libshaderc_util/src/file_finder.cc", - "libshaderc_util/src/io_shaderc.cc", - "libshaderc_util/src/message.cc", - "libshaderc_util/src/resources.cc", - "libshaderc_util/src/shader_stage.cc", - "libshaderc_util/src/spirv_tools_wrapper.cc", - "libshaderc_util/src/version_profile.cc", - ] - - # Configure Glslang's interface to include HLSL-related entry points. - defines = [ "ENABLE_HLSL=1" ] - - public_configs = [ ":shaderc_util_public" ] - - deps = [ - "${glslang_dir}:glslang_sources", - "${spirv_tools_dir}:spvtools", - ] - - if (build_with_chromium) { - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - } -} - -config("shaderc_public") { - include_dirs = [ "libshaderc/include" ] - if (is_component_build) { - defines = [ "SHADERC_SHAREDLIB" ] - } -} - -component("libshaderc") { - public_configs = [ - ":shaderc_public", - ":shaderc_util_public", - ] - - defines = [ "SHADERC_IMPLEMENTATION" ] - - sources = [ - "libshaderc/include/shaderc/env.h", - "libshaderc/include/shaderc/shaderc.h", - "libshaderc/include/shaderc/shaderc.hpp", - "libshaderc/include/shaderc/status.h", - "libshaderc/include/shaderc/visibility.h", - "libshaderc/src/shaderc.cc", - "libshaderc/src/shaderc_private.h", - ] - - deps = [ - ":shaderc_util_sources", - "${spirv_tools_dir}:spvtools", - "${spirv_tools_dir}:spvtools_val", - "${glslang_dir}:glslang_sources", - ] - - if (build_with_chromium) { - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - } -} diff --git a/lib/shaderc/CHANGES b/lib/shaderc/CHANGES deleted file mode 100644 index e592214f1..000000000 --- a/lib/shaderc/CHANGES +++ /dev/null @@ -1,304 +0,0 @@ -Revision history for Shaderc - -v2022.1 2022-01-27 - - Update DEPS to include two fixes on top of SPIRV-Tools v2022.1: - - Validator handles Nontemporal image operand - - Optimizer handles RayQueryKHR type - -v2022.0 2022-01-27 - - Update to Glslang 11.8.0 - -v2021.4 2022-01-27 - - Support Vulkan 1.3 - - Support targeting SPIR-V 1.6, which is the default for Vulkan 1.3 - - Updated copyright check: Excludes Glslang generated files when - building in source tree - - Fix Android.mk rules for building libshaderc_combined, to adapt to more - recent NDKs that have removed the GNU binutils. - -v2021.3 2021-11-11 - - Add build switch to disable copyright check - - Update DEPS: - - SPIRV-Tools v2021.4 - - SPIRV-Headers GitHub master 2021-11-11 - - Glslang GitHub master 2021-11-11 - -v2021.2 2021-08-25 - - README: Mention Common Lisp bindings (external) - - Update DEPS: - - SPIRV-Tools v2021.3 - - SPIRV-Headers master 2021-08-25 - - Glslang GitHub master 2021-08-25 - -v2021.1 2021-06-21 - - Disable --target-env=opengl_compat with an explicit error message - - It has been deprecated for a long time. - -v2021.0 2021-04-21 - - Refresh dependencies (in DEPS): - - SPIRV-Tools v2021.1 - - SPIRV-Headers snapshot 2021-04-21 - - Glslang 11.2.0, snapshot 2021-04-21 - - Fixes: - #1174: Windows Bazel support: rename internal headers io.* to io_shaderc.* - -v2020.5 2021-02-19 - - Refresh dependencies (in DEPS): - - SPIRV-Tools v2020.7 + 1 patch - - Glslang 11.1.0 - - Add option to skip building examples - - Fixes: - #1153: Improve file+line parsing from Glslang messages - -v2020.4 2020-12-09 - - Removed svpc - - Fixed issues with embedders getting duplicate symbols - - Converted C-style casts to static_cast - - Rolled ahead to fix/pickup Vulkan Raytracing support - -v2020.3 2020-09-02 - - General: - - Last release with spvc - - Cleaned up issues discovered by Infer - - spvc: - - Added support for Dawn using deprecated Options constructor - - Adding support for the additional fixed sample mask in MSL - -v2020.2 2020-07-23 - - General: - - Remove VS2013 support - - Support both posix and non-posix MinGW toolchains - - Support optionally building Tint tooling for WGSL - - Add -h option to glslc, spvc; same as --help - - Add source file license checker - - BUILD.gn improvements - - - glslc, libshaderc: - - Update to Glslang generator 9 - - Add interface to support 16bit types in HLSL - - Add glslc hidden experimental option -mfmt=wgsl; requires Tint - - - spvc: - - Add minimum buffer size for Dawn reflection - -v2020.1 2020-06-09 - This is the last version that officially supports VS2013. - - - General: - - Added warning signs about unsupported downloads (#1041) - - Added .NET bindings to README.md (#1060) - - Only add -fPIC if supported by the compiler. (#1061) - - - glslc, libshaderc: - - Removed Singleton pattern around access to glslang (#1059) - - - spvc: - - Added concept of comparison sampler to API (#1036) - - Added support for options.hlsl.nonwritable_uav_texture_as_srv (#1048) - - Support forcing storage buffers to be always declared as UAV. (#1076) - -v2020.0 2020-03-06 - - General: - - Getting spirv.hpp from SPIRV-Headers instead of not glslang (#992) - - Added clarification about status of artifacts in downloads.md (#1012) - - - glslc, libshaderc: - - Added support for new Glslang profile enum, EProfileCount (#973) - - Updated user documentation for -S in glslc (#978) - - Add documentation for Vulkan 1.2 and SPIR-V 1.5 (#980) - - Removed NV_EXTENSIONS conditionals (#1003) - - Added support for generating WebGPU SPIR-V to libshaderc (#1021) - - Rolled in all DEPS for provisional SPIR-V extensions for raytracing - - - spvc: - - Normalized API behaviour (#967) - - Added source_set target for libshaderc_spvc (#976) - - Added in support for spvc logging to the terminal (#981) - - Internal refactoring to reduce boiler plate in API implementations (#984) - - Added newline to logging messages to make them readable (#985) - - Added reflection support for Dawn: - - storage textures (#1001) - - storage texture format (#1005) - - texture dimension for storage textures (#1008) - - is storage texture declared as multisampled texture (#1011) - - Converted compile options to require explicit environments (#1019) - - Added knob to control force_zero_initialized_variables in SPIRV-Cross (#1028) - -v2019.1 2020-01-22 - - glslc, libshaderc: - - Add -fnan-clamp: Generate code for max and min builtins so that, - given a NaN operand, will return the other operand. Similarly, the - clamp builtin favours non-NaN operands, as if clamp was implemented - as the composition of max and min. - - Add -finvert-y - - Using SetBeforeHlslLegalization for more relaxed validation rules - - Added support for SPIR-V 1.5 - - Add --emit-line-directive option - - Added support for Vulkan 1.2 - - spvc: - - Add many options: - --flatten-multidimensional-arrays - --es - --no-es - --glsl-emit-push-constant-as-ubo - --msl-swizzle-texture-samples - --msl-platform=ios|macos - --msl-pad-fragment-output - --msl-capture-output - --msl-domain-lower-left - --msl-argument-buffers - --msl-discrete-descriptor-set= - --hlsl-enable-compat - - Reintroduce shaderc_spvc_compile_options_set_shader_model - - Added option to inject robust buffer access code - - Added support for emitting ToVulkan shaders - - Added spirv-opt based IR generation as alternative to built in spirv_cross IR gen - - Added API for specifying source and target execution environments - - Added option & reflection API methods neede by Dawn - - Substantial internal refactoring and code cleanup - - Large number of breaking changes to the API - - Replaced shaderc_spvc_compile_options_set_shader_model with - shaderc_spvc_compile_options_set_hlsl_shader_model - - Compiler initialization and shader generation moved into seperate calls - - Seperated return codes from shaderc ones - - Many small API changes - - Improvements to testing - - Refactoring and clean up of run_spirv_cross_tests.py - - Seperation of expectations into known failures, known invalids, and cases - that need investigation - - Tweaks and fixes to substantially increase passing cases - - Added support for running tests using spvc IR generation - - Infrastructure - - Update DEPS with cross-verified commits from associated repos. - - Add utils/roll-deps - - Infrastructure: - - Removed Appveyor artifacts link - - Improvements and clean up of DEPS rolling scripts - - Enabled warnings about implicit fallthrough - - Enabled improper semicolon warnings - - Restricted -fPIC to platforms that support it - - Converted remaining scripts to use Python 3 - - Replaced nosetest with unittest - - Removed assumptions aabout location of spirv-tools, effcee, and RE2 - - Migrated BUILD.gn spirv_cross dependency to local repo - - Fixes: - - Fix duplicate install paths when using VisualStudio - - Fixed BUILD.gn for Chromium, Dawn & Fuchsia - - Explicitly enabled HLSL support in glslang - - Added installing necessary headers in Android.mk - - Removed unsupported Unicode characters - - Fixed detection of spirv-headers directory - #666: Update Docker file to use Python3 - -v2019.0 2019-06-04 - - Add optional spvc, libshaderc_spvc as wrapper around SPIRV-Cross: - - Rejects bad modules by running the SPIR-V validator first - - Skips exception-heavy SPIRV-Cross SPIR-V parser - - Support NV extensions for shader stages - - Require SPIRV-Tools and SPIRV-Headers with SPIR-V 1.4 support - Build support: - - Use KhronosGroup/glslang instead of google/glslang - - Stop running tests on VS 2013 (googletest no longer supports VS2013) - - Require Python3 for building - - Support Chromium's GN build system - - Kokoro build fixes - - Cmake build fixes: Only build subdirs if those targets are not yet defined - - Use Android.mk from Glslang - - Dockerfile gets re2 and effcee sources - - Fixes for newer googletest - - Add address sanitizer presubmit bot - - Generate config files for pkg-config - Spvc: - - Add option to specify source environment. Spvc will transform from source - to target environment if they are different. This only works for WebGPU0 - and Vulkan 1.1. - Fixes: - #499: In HLSL compilation, relax layout and logical pointer validation rules - prior to running the legalization recipe. - -v2018.0 2018-10-01 - - Support -fhlsl_functionality1 (also -fhlsl-functionality1) - - Support NVIDIA Turing extensions. Requires updated Glslang and SPIRV-Tools. - - Use SPIR-V optimization and HLSL legalization recipes from SPIRV-Tools. - - Pass target environment into SPIRV-Tools code, e.g. from --target-env vulkan1.1 - - Add SONAME=1 property to shared library - - Support GN build for Chromium - Fixes: - #469: Add virtual dtor to classes with virtual functions. - #457: Fix writing SPIR-V binaries to standard output on Windows. - -v2017.2 2018-02-27 - - Add a shared library version of libshaderc - - Support GLSL 4.6 and ESSL 3.2 - - Fail compilation if a resource does not have a binding. - - Add options for automatically setting bindings for (uniform) resources that - don't have bindings set in shader source. - - Add options for automatically setting locations for pipline inputs and outputs. - - Add option for using HLSL IO mappings as expressed in source. - - Add options for setting resource binding base numbers. - - Add option to use HLSL resource register numbers for bindings. - - HLSL compilation now defaults to HLSL packing rules. - (This change is inherited from Glslang commit 7cca140.) - - HLSL compilation runs SPIR-V "legalization" transforms to reduce - manipulation of opaque handles (e.g. images), to satisfy Vulkan rules. - - Adapt to Glslang generator version numbers: - - To 2: a fix for code generation for atomicCounterDecrement. - - To 3: change memory barrier semantics masks - - To 4: generate more access chains for swizzles - - CMake install rules uses GNUInstallDirs. For example, install to lib64 - when that is the norm for the target system. - -v2017.1 2017-03-10 - - Add option to automatically assign bindings to uniform variables - that don't have an explicit 'binding' layout in the shader source. - - Enable NVIDIA extensions by default in GLSL compilation - - README mentions language bindings provided by 3rd parties. - - README describes the known-good branch on GitHub - - Fixed examples in shaderc.h; added C API use to examples/online-compile - - Fixes issues: - #289: Don't output an object file when compilation fails. - #296: Enable use of the CMake in Android Studio. - -v2016.2 2016-12-13 - - Describe Shaderc's level of stability. - - Support HLSL compilation, exposing functionality in Glslang. - - Supported in C, C++ API - - glslc accepts "-x hlsl", and assumes .hlsl files are HLSL. - - glslc accepts "-fentry-point=" to set entry point name, - overriding default value "main". - - Support setting shader resource limits in C, C++ APIs, and in - glslc - - glslc adds -flimit= - - glslc adds --show-limits to display defaults and valid resource - limit syntax. - - glslc adds "-flimit-file " support to read Glslang resource - configuration files, i.e. the output of "glslangValidator -c". - - Enable AMD extensions by default in GLSL compilation - - Fixes issues: - #281: Work around Android build issue with abspath on Windows - #283: Increase default maxDrawBuffers to 4, to match Vulkan/GLES3.0 - -v2016.1 2016-10-12 - - C API for assembling now takes an options object - - Support compilation options to optimize for size. - - Maintain compatibility with recent SPIRV-Tools and Glslang versions. - - Update examples. - - Build cleanups. - - Fixes issues: - #238: Fix invocation of python scripts during build - -v2016.0 2016-07-07 - - - Adds v. versioning, with "-dev" suffix to indicate work in - progress. The intent is to summarize and report functionalities more easily - for incorporating into downstream projects. - - - Summary of functionalities (See the README.md for more details): - - Provides libraries and command line tools for generating SPIR-V modules - - Supports GLSL source code or SPIR-V assembly as input - - Supports SPIR-V binary or assembly text as output - - Command line options follow GCC/Clang conventions - - Supports various semantics (OpenGL, OpenGL Compatible and Vulkan) - - Supports #include - - Supports user-defined macros - - Supports dependency information dumping diff --git a/lib/shaderc/CMakeLists.txt b/lib/shaderc/CMakeLists.txt deleted file mode 100644 index a8059f114..000000000 --- a/lib/shaderc/CMakeLists.txt +++ /dev/null @@ -1,165 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -cmake_minimum_required(VERSION 2.8.12) -project(shaderc) -enable_testing() - -if ("${CMAKE_BUILD_TYPE}" STREQUAL "") - message(STATUS "No build type selected, default to Debug") - set(CMAKE_BUILD_TYPE "Debug") -endif() - -message(STATUS "Shaderc: build type is \"${CMAKE_BUILD_TYPE}\".") - -option(SHADERC_ENABLE_WGSL_OUTPUT "Enable WGSL output" OFF) - -option(SHADERC_SKIP_INSTALL "Skip installation" ${SHADERC_SKIP_INSTALL}) -if(NOT ${SHADERC_SKIP_INSTALL}) - set(SHADERC_ENABLE_INSTALL ON) -endif() - -option(SHADERC_SKIP_TESTS "Skip building tests" ${SHADERC_SKIP_TESTS}) -if(NOT ${SHADERC_SKIP_TESTS}) - set(SHADERC_ENABLE_TESTS ON) -endif() -if(${SHADERC_ENABLE_TESTS}) - message(STATUS "Configuring Shaderc to build tests.") -else() - message(STATUS "Configuring Shaderc to avoid building tests.") -endif() - -option(SHADERC_SKIP_EXAMPLES "Skip building examples" ${SHADERC_SKIP_EXAMPLES}) -if(NOT ${SHADERC_SKIP_EXAMPLES}) - set(SHADERC_ENABLE_EXAMPLES ON) -endif() -if(${SHADERC_ENABLE_EXAMPLES}) - message(STATUS "Configuring Shaderc to build examples.") -else() - message(STATUS "Configuring Shaderc to avoid building examples.") -endif() - -option(SHADERC_SKIP_COPYRIGHT_CHECK "Skip copyright check" ${SHADERC_SKIP_COPYRIGHT_CHECK}) -if(NOT ${SHADERC_SKIP_COPYRIGHT_CHECK}) - set(SHADERC_ENABLE_COPYRIGHT_CHECK ON) -endif() -if(${SHADERC_ENABLE_COPYRIGHT_CHECK}) - message(STATUS "Configuring Shaderc to check copyrights.") -else() - message(STATUS "Configuring Shaderc to avoid checking copyrights.") -endif() - -option(SHADERC_ENABLE_WERROR_COMPILE "Enable passing -Werror to compiler, if available" ON) - -set (CMAKE_CXX_STANDARD 11) - -include(GNUInstallDirs) -include(cmake/setup_build.cmake) -include(cmake/utils.cmake) -include(CheckCXXCompilerFlag) - -set(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS ${DISABLE_EXCEPTIONS} CACHE BOOL "Coupling SPIRV-Cross exception conversion to DISABLE_EXCEPTIONS" FORCE) -if(DISABLE_EXCEPTIONS) - # Need to set additional values here, since some of the wrapped code occurs in - # .h/.hpp files, so maybe included outside of the library. - add_definitions(-DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) -endif() - -# These flags are not supported on Windows and some older version of GCC -# that our bots use. -# Warning about implicit fallthrough in switch blocks -check_cxx_compiler_flag(-Wimplicit-fallthrough COMPILER_SUPPORTS_FALLTHROUGH_WARNING) -if (COMPILER_SUPPORTS_FALLTHROUGH_WARNING) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wimplicit-fallthrough") -endif() - -# Warning about extra semi-colons -check_cxx_compiler_flag(-Wextra-semi COMPILER_SUPPORTS_EXTRA_SEMI_WARNING) -if (COMPILER_SUPPORTS_EXTRA_SEMI_WARNING) - add_compile_options("-Wextra-semi") -endif() - -find_host_package(PythonInterp 3 REQUIRED) - -if (SHADERC_ENABLE_COPYRIGHT_CHECK) - add_custom_target(check-copyright ALL - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py - --check - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Check copyright") -endif() - -add_custom_target(add-copyright - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/add_copyright.py - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMENT "Add copyright") - -if(MSVC) - option(SHADERC_ENABLE_SHARED_CRT - "Use the shared CRT instead of the static CRT" - ${SHADERC_ENABLE_SHARED_CRT}) - if (NOT SHADERC_ENABLE_SHARED_CRT) - # Link executables statically by replacing /MD with /MT everywhere. - foreach(flag_var - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - endif(NOT SHADERC_ENABLE_SHARED_CRT) -endif(MSVC) - - -# Configure subdirectories. -# We depend on these for later projects, so they should come first. -add_subdirectory(third_party) - -add_subdirectory(libshaderc_util) -add_subdirectory(libshaderc) -if(${SHADERC_ENABLE_EXAMPLES}) - add_subdirectory(examples) -endif() - -add_custom_target(build-version - ${PYTHON_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py - ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/build-version.inc - COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).") - -function(define_pkg_config_file NAME LIBS) - add_custom_target(${NAME}-pkg-config ALL - COMMAND ${CMAKE_COMMAND} - -DCHANGES_FILE=${CMAKE_CURRENT_SOURCE_DIR}/CHANGES - -DTEMPLATE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/cmake/${NAME}.pc.in - -DOUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/${NAME}.pc - -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR} - -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR} - -DLIBS=${LIBS} - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/write_pkg_config.cmake - DEPENDS "CHANGES" "cmake/${NAME}.pc.in" "cmake/write_pkg_config.cmake") - - if (SHADERC_ENABLE_INSTALL) - install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.pc - DESTINATION - ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - endif() -endfunction() - -define_pkg_config_file(shaderc -lshaderc_shared) -define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util") -define_pkg_config_file(shaderc_combined -lshaderc_combined) diff --git a/lib/shaderc/CONTRIBUTING.md b/lib/shaderc/CONTRIBUTING.md deleted file mode 100644 index 24ff04c4b..000000000 --- a/lib/shaderc/CONTRIBUTING.md +++ /dev/null @@ -1,25 +0,0 @@ -Want to contribute? Great! First, read this page (including the small print at -the end). Then, have a look at [`DEVELOPMENT.howto.md`](DEVELOPMENT.howto.md), -which contains useful info to guide you along the way. - -## Before you contribute - -Before we can use your code, you must sign the -[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1) -(CLA), which you can do online. The CLA is necessary mainly because you own the -copyright to your changes, even after your contribution becomes part of our -codebase, so we need your permission to use and distribute your code. We also -need to be sure of various other things -- for instance that you'll tell us if -you know that your code infringes on other people's patents. You don't have to -sign the CLA until after you've submitted your code for review and a member has -approved it, but you must do it before we can put your code into our codebase. - -Before you start working on a larger contribution, you should get in touch with -us first through the issue tracker with your idea so that we can help out and -possibly guide you. Coordinating up front makes it much easier to avoid -frustration later on. - -## The small print - -Contributions made by corporations are covered by a different agreement than -the one above, the Software Grant and Corporate Contributor License Agreement. diff --git a/lib/shaderc/CONTRIBUTORS b/lib/shaderc/CONTRIBUTORS deleted file mode 100644 index a26753536..000000000 --- a/lib/shaderc/CONTRIBUTORS +++ /dev/null @@ -1,24 +0,0 @@ -# People who have agreed to one of the CLAs and can contribute patches. -# The AUTHORS file lists the copyright holders; this file -# lists people. For example, Google employees are listed here -# but not in AUTHORS, because Google holds the copyright. -# -# https://developers.google.com/open-source/cla/individual -# https://developers.google.com/open-source/cla/corporate -# -# Names should be added to this file as: -# Name - -Lei Zhang -David Neto -Andrew Woloszyn -Stefanus Du Toit -Dejan Mircevski -Mark Adams -Jason Ekstrand -Damien Mabin -Qining Lu -Jakob Vogel -David Yen -Adam Chainz -Robin Quint diff --git a/lib/shaderc/DEPS b/lib/shaderc/DEPS deleted file mode 100644 index 15cf269b0..000000000 --- a/lib/shaderc/DEPS +++ /dev/null @@ -1,33 +0,0 @@ -use_relative_paths = True - -vars = { - 'google_git': 'https://github.com/google', - 'khronos_git': 'https://github.com/KhronosGroup', - - 'effcee_revision' : '2ec8f8738118cc483b67c04a759fee53496c5659', - 'glslang_revision': 'c34bb3b6c55f6ab084124ad964be95a699700d34', - 'googletest_revision': '389cb68b87193358358ae87cc56d257fd0d80189', - 're2_revision': '7107ebc4fbf7205151d8d2a57b2fc6e7853125d4', - 'spirv_headers_revision': 'b42ba6d92faf6b4938e6f22ddd186dbdacc98d78', - 'spirv_tools_revision': 'b846f8f1dc2d79f2b5ce27d5ad901f885da1cf82', -} - -deps = { - 'third_party/effcee': Var('google_git') + '/effcee.git@' + - Var('effcee_revision'), - - 'third_party/googletest': Var('google_git') + '/googletest.git@' + - Var('googletest_revision'), - - 'third_party/glslang': Var('khronos_git') + '/glslang.git@' + - Var('glslang_revision'), - - 'third_party/re2': Var('google_git') + '/re2.git@' + - Var('re2_revision'), - - 'third_party/spirv-headers': Var('khronos_git') + '/SPIRV-Headers.git@' + - Var('spirv_headers_revision'), - - 'third_party/spirv-tools': Var('khronos_git') + '/SPIRV-Tools.git@' + - Var('spirv_tools_revision'), -} diff --git a/lib/shaderc/DEVELOPMENT.howto.md b/lib/shaderc/DEVELOPMENT.howto.md deleted file mode 100644 index b2c9d800d..000000000 --- a/lib/shaderc/DEVELOPMENT.howto.md +++ /dev/null @@ -1,52 +0,0 @@ -Thank you for considering Shaderc development! Please make sure you review -[`CONTRIBUTING.md`](CONTRIBUTING.md) for important preliminary info. - -## Building - -Instructions for first-time building can be found in [`README.md`](README.md). -Incremental build after a source change can be done using `ninja` (or -`cmake --build`) and `ctest` exactly as in the first-time procedure. - -## Code reviews - -(Terminology: we consider everyone with write access to our GitHub repo a -project _member_.) - -All submissions, including submissions by project members, require review. We -use GitHub pull requests to facilitate the review process. A submission may be -accepted by any project member (other than the submitter), who will then squash -the changes into a single commit and cherry-pick them into the repository. - -Before accepting, there may be some review feedback prompting changes in the -submission. You should expect reviewers to strictly insist on the -[commenting](https://google.github.io/styleguide/cppguide.html#Comments) -guidelines -- in particular, every file, class, method, data member, and global -will require a comment. Reviewers will also expect to see test coverage for -every code change. _How much_ coverage will be a judgment call on a -case-by-case basis, balancing the required effort against the incremental -benefit. Coverage will be expected. As a matter of development philosophy, -we will strive to engineer the code to make writing tests easy. - -## Coding style - -For our C++ files, we use the -[Google C++ style guide](https://google.github.io/styleguide/cppguide.html). -(Conveniently, the formatting rules it specifies can be achieved using -`clang-format -style=google`.) - -For our Python files, we use the -[Google Python style guide](https://google.github.io/styleguide/pyguide.html). - -## Supported platforms - -We expect Shaderc to always build and test successfully on the platforms listed -below. Please keep that in mind when offering contributions. This list will -likely grow over time. - -| Platform | Build Status | -|:--------:|:------------:| -| Android (ARMv7) | Not Automated | -| Linux (x86_64) | [![Linux Build Status](https://travis-ci.org/google/shaderc.svg)](https://travis-ci.org/google/shaderc "Linux Build Status") | -| Mac OS X | [![Mac Build Status](https://travis-ci.org/google/shaderc.svg)](https://travis-ci.org/google/shaderc "Mac Build Status") | -| Windows (x86_64) | [![Windows Build status](https://ci.appveyor.com/api/projects/status/g6c372blna7vnk1l?svg=true)](https://ci.appveyor.com/project/dneto0/shaderc "Windows Build Status") | - diff --git a/lib/shaderc/Dockerfile b/lib/shaderc/Dockerfile deleted file mode 100644 index 882123908..000000000 --- a/lib/shaderc/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2016 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM alpine - -MAINTAINER Google Shaderc Team - -RUN apk add --update \ - build-base \ - cmake \ - git \ - ninja \ - python3 \ - py-pip \ - && rm -rf /var/cache/apk/* - -WORKDIR /root -RUN git clone https://github.com/google/shaderc - -WORKDIR shaderc -RUN ./utils/git-sync-deps - -WORKDIR build -RUN cmake -GNinja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr/local \ - .. \ - && ninja install - -WORKDIR /root -RUN rm -rf shaderc - -RUN adduser -s /bin/sh -D shaderc -USER shaderc - -VOLUME /code -WORKDIR /code - -CMD ["/bin/sh"] diff --git a/lib/shaderc/LICENSE b/lib/shaderc/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/lib/shaderc/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/lib/shaderc/README.md b/lib/shaderc/README.md deleted file mode 100644 index c26234034..000000000 --- a/lib/shaderc/README.md +++ /dev/null @@ -1,262 +0,0 @@ -# Shaderc - -A collection of tools, libraries and tests for shader compilation. -At the moment it includes: - -- [`glslc`](glslc), a command line compiler for GLSL/HLSL to SPIR-V, and -- [`libshaderc`](libshaderc), a library API for accessing `glslc` functionality. - -**Note:** The fact that that `libshaderc` is not named `libshaderc_glslc` is a -quirk of history, and a known inconsistency. Changing it would require a -significant amount of renaming and breaking of downstream projects, so it is -being left as is. - -`glslc` wraps around core functionality in [glslang][khr-glslang] -and [SPIRV-Tools][spirv-tools]. `glslc` and its library aims to -to provide: -* a command line compiler with GCC- and Clang-like usage, for better - integration with build systems -* an API where functionality can be added without breaking existing clients -* an API supporting standard concurrency patterns across multiple - operating systems -* increased functionality such as file `#include` support - -## Downloads - -**Note: These binaries are just the artifacts of the builders and have not - undergone any QA, thus they should be considered unsupported.** - -Linux[![Linux Build Status](https://storage.googleapis.com/shaderc/badges/build_status_linux_clang_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_release.html) -MacOS[![MacOS Build Status](https://storage.googleapis.com/shaderc/badges/build_status_macos_clang_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_release.html) -Windows[![Windows Build Status](https://storage.googleapis.com/shaderc/badges/build_status_windows_vs2017_release.svg)](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2017_release.html) - -[More downloads](downloads.md) - -## Status - -Shaderc has maintained backward compatibility for quite some time, and we -don't anticipate any breaking changes. -Ongoing enhancements are described in the [CHANGES](CHANGES) file. - -Shaderc has been shipping in the -[Android NDK](https://developer.android.com/ndk/index.html) since version r12b. -(The NDK build uses sources from https://android.googlesource.com/platform/external/shaderc/. -Those repos are downstream from GitHub.) -We currently require r18b. - -For licensing terms, please see the [`LICENSE`](LICENSE) file. If interested in -contributing to this project, please see [`CONTRIBUTING.md`](CONTRIBUTING.md). - -This is not an official Google product (experimental or otherwise), it is just -code that happens to be owned by Google. That may change if Shaderc gains -contributions from others. See the [`CONTRIBUTING.md`](CONTRIBUTING.md) file -for more information. See also the [`AUTHORS`](AUTHORS) and -[`CONTRIBUTORS`](CONTRIBUTORS) files. - -## File organization - -- `android_test/` : a small Android application to verify compilation -- `cmake/`: CMake utility functions and configuration for Shaderc -- `examples/`: Example programs -- `glslc/`: an executable to compile GLSL to SPIR-V -- `libshaderc/`: a library for compiling shader strings into SPIR-V -- `libshaderc_util/`: a utility library used by multiple shaderc components -- `third_party/`: third party open source packages; see below -- `utils/`: utility scripts for Shaderc - -Shaderc depends on glslang, the Khronos reference compiler for GLSL. - -Shaderc depends on [SPIRV-Tools][spirv-tools] for assembling, disassembling, -and transforming SPIR-V binaries. - -Shaderc depends on the [Google Test](https://github.com/google/googletest) -testing framework. - -In the following sections, `$SOURCE_DIR` is the directory you intend to clone -Shaderc into. - -## Getting and building Shaderc - -**If you only want prebuilt executables or libraries, see the -[Downloads](#downloads) section.** - -The rest of this section describes how to build Shaderc from sources. - -Note: Shaderc assumes Glslang supports HLSL compilation. The instructions -below assume you're building Glslang from sources, and in a subtree -of `shaderc/third_party`. In that scenario, Glslang's HLSL support -is automatically enabled. Shaderc also can be built using a Glslang -from outside the `shaderc/third_party` tree. In that case you must -ensure that that external Glslang is built with HLSL functionality. -See Glslang's `ENABLE_HLSL` CMake setting.) - -1) Check out the source code: - -```sh -git clone https://github.com/google/shaderc $SOURCE_DIR -cd $SOURCE_DIR -./utils/git-sync-deps -``` - -**Note:** The [known-good](https://github.com/google/shaderc/tree/known-good) -branch of the repository contains a -[known_good.json](https://github.com/google/shaderc/blob/known-good/known_good.json) -file describing a set of repo URLs and specific commits that have been -tested together. This information is updated periodically, and typically -matches the latest update of these sources in the development branch -of the Android NDK. -The `known-good` branch also contains a -[update_shaderc.py](https://github.com/google/shaderc/blob/known-good/update_shaderc_sources.py) -script that will read the JSON file and checkout those specific commits for you. - -2) Ensure you have the requisite tools -- see the tools subsection below. - -3) Decide where to place the build output. In the following steps, we'll call it - `$BUILD_DIR`. Any new directory should work. We recommend building outside - the source tree, but it is also common to build in a (new) subdirectory of - `$SOURCE_DIR`, such as `$SOURCE_DIR/build`. - -4a) Build (and test) with Ninja on Linux or Windows: - -```sh -cd $BUILD_DIR -cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} $SOURCE_DIR -ninja -ctest # optional -``` - -4b) Or build (and test) with MSVC on Windows: - -```sh -cd $BUILD_DIR -cmake $SOURCE_DIR -cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} -ctest -C {Release|Debug|MinSizeRel|RelWithDebInfo} -``` - -4c) Or build with MinGW on Linux for Windows: -(Skip building threaded unit tests due to -[Googletest bug 606](https://github.com/google/googletest/issues/606)) - -```sh -cd $BUILD_DIR -cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} $SOURCE_DIR \ - -DCMAKE_TOOLCHAIN_FILE=$SOURCE_DIR/cmake/linux-mingw-toolchain.cmake \ - -Dgtest_disable_pthreads=ON -ninja -``` - -After a successful build, you should have a `glslc` executable somewhere under -the `$BUILD_DIR/glslc/` directory, as well as a `libshaderc` library somewhere -under the `$BUILD_DIR/libshaderc/` directory. - -The default behavior on MSVC is to link with the static CRT. If you would like -to change this behavior `-DSHADERC_ENABLE_SHARED_CRT` may be passed on the -cmake configure line. - -See [the libshaderc README](libshaderc/README.md) for more on using the library -API in your project. - -### Tools you'll need - -For building, testing, and profiling Shaderc, the following tools should be -installed regardless of your OS: - -- [CMake](http://www.cmake.org/): for generating compilation targets. -- [Python 3](http://www.python.org/): for utility scripts and running the test suite. - -On Linux, the following tools should be installed: - -- [`gcov`](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html): for testing code - coverage, provided by the `gcc` package on Ubuntu. -- [`lcov`](http://ltp.sourceforge.net/coverage/lcov.php): a graphical frontend - for `gcov`, provided by the `lcov` package on Ubuntu. -- [`genhtml`](http://linux.die.net/man/1/genhtml): for creating reports in html - format from `lcov` output, provided by the `lcov` package on Ubuntu. - -On Linux, if cross compiling to Windows: -- [`mingw`](http://www.mingw.org): A GCC-based cross compiler targeting Windows - so that generated executables use the Microsoft C runtime libraries. - -On Windows, the following tools should be installed and available on your path: - -- Visual Studio 2015 or later. Previous versions of Visual Studio may work but - are untested and unsupported. -- Git - including the associated tools, Bash, `diff`. - -Optionally, the following tools may be installed on any OS: - - - [`asciidoctor`](http://asciidoctor.org/): for generating documentation. - - [`pygments.rb`](https://rubygems.org/gems/pygments.rb) required by - `asciidoctor` for syntax highlighting. - -### Building and running Shaderc using Docker - -Please make sure you have the Docker engine -[installed](https://docs.docker.com/engine/installation/) on your machine. - -To create a Docker image containing Shaderc command line tools, issue the -following command in `${SOURCE_DIR}`: `docker build -t .`. -The created image will have all the command line tools installed at -`/usr/local` internally, and a data volume mounted at `/code`. - -Assume `` is `shaderc/shaderc` from now on. - -To invoke a tool from the above created image in a Docker container: - -```bash -docker run shaderc/shaderc glslc --version -``` - -Alternatively, you can mount a host directory (e.g., `example`) containing -the shaders you want to manipulate and run different kinds of tools via -an interactive shell in the container: - -```bash -$ docker run -i -t -v `pwd`/example:/code shaderc/shaderc -/code $ ls -test.vert -/code $ glslc -c -o - test.vert | spirv-dis -``` - -## Bug tracking - -We track bugs using GitHub -- click on the "Issues" button on -[the project's GitHub page](https://github.com/google/shaderc). - -## Test coverage - -On Linux, you can obtain test coverage as follows: - -```sh -cd $BUILD_DIR -cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DENABLE_CODE_COVERAGE=ON $SOURCE_DIR -ninja -ninja report-coverage -``` - -Then the coverage report can be found under the `$BUILD_DIR/coverage-report` -directory. - -## Bindings - -Bindings are maintained by third parties, may contain content -offered under a different license, and may reference or contain -older versions of Shaderc and its dependencies. - -* **Python:** [pyshaderc][pyshaderc] -* **Rust:** [shaderc-rs][shaderc-rs] -* **Go:** [gshaderc][gshaderc] -* **.NET:** [shaderc.net][shadercdotnet] -* **Common Lisp:** [shadercl][shaderccommonlisp] - -[khr-glslang]: https://github.com/KhronosGroup/glslang -[spirv-tools]: https://github.com/KhronosGroup/SPIRV-Tools -[spirv-cross]: https://github.com/KhronosGroup/SPIRV-Cross -[pyshaderc]: https://github.com/realitix/pyshaderc -[shaderc-rs]: https://github.com/google/shaderc-rs -[appveyor]: https://ci.appveyor.com/project/dneto0/shaderc -[dawn]: https://dawn.googlesource.com/dawn -[gshaderc]: https://github.com/celer/gshaderc -[shadercdotnet]: https://github.com/jpbruyere/shaderc.net -[shaderccommonlisp]: https://github.com/JolifantoBambla/shadercl diff --git a/lib/shaderc/cmake/linux-mingw-toolchain.cmake b/lib/shaderc/cmake/linux-mingw-toolchain.cmake deleted file mode 100644 index 60e965e41..000000000 --- a/lib/shaderc/cmake/linux-mingw-toolchain.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -SET(CMAKE_SYSTEM_NAME Windows) - -set(MINGW_COMPILER_PREFIX "i686-w64-mingw32" CACHE STRING - "What compiler prefix to use for mingw") - -set(MINGW_SYSROOT "/usr/${MINGW_COMPILER_PREFIX}" CACHE STRING - "What sysroot to use for mingw") - -# Which compilers to use for C and C++ -find_program(CMAKE_RC_COMPILER NAMES ${MINGW_COMPILER_PREFIX}-windres) -find_program(CMAKE_C_COMPILER NAMES - ${MINGW_COMPILER_PREFIX}-gcc-posix - ${MINGW_COMPILER_PREFIX}-gcc) -find_program(CMAKE_CXX_COMPILER NAMES - ${MINGW_COMPILER_PREFIX}-g++-posix - ${MINGW_COMPILER_PREFIX}-g++) - -SET(CMAKE_FIND_ROOT_PATH ${MINGW_SYSROOT}) - -# Adjust the default behaviour of the FIND_XXX() commands: -# Search headers and libraries in the target environment; search -# programs in the host environment. -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/lib/shaderc/cmake/setup_build.cmake b/lib/shaderc/cmake/setup_build.cmake deleted file mode 100644 index 58f149b51..000000000 --- a/lib/shaderc/cmake/setup_build.cmake +++ /dev/null @@ -1,141 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -if(NOT COMMAND find_host_package) - macro(find_host_package) - find_package(${ARGN}) - endmacro() -endif() -if(NOT COMMAND find_host_program) - macro(find_host_program) - find_program(${ARGN}) - endmacro() -endif() - -# Find asciidoctor; see shaderc_add_asciidoc() from utils.cmake for -# adding documents. -#find_program(ASCIIDOCTOR_EXE NAMES asciidoctor) -#if (NOT ASCIIDOCTOR_EXE) -# message(STATUS "asciidoctor was not found - no documentation will be" -# " generated") -#endif() - -# On Windows, CMake by default compiles with the shared CRT. -# Ensure that gmock compiles the same, otherwise failures will occur. -if(WIN32) - # TODO(awoloszyn): Once we support selecting CRT versions, - # make sure this matches correctly. - set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -endif(WIN32) - -if (ANDROID) -# For android let's preemptively find the correct packages so that -# child projects (glslang, googletest) do not fail to find them. - -# Tests in glslc and SPIRV-Tools tests require Python 3, or a Python 2 -# with the "future" package. Require Python 3 because we can't force -# developers to manually install the "future" package. -find_host_package(PythonInterp 3 REQUIRED) -find_host_package(BISON) -else() -find_package(PythonInterp 3 REQUIRED) -endif() - - -option(ENABLE_CODE_COVERAGE "Enable collecting code coverage." OFF) -if (ENABLE_CODE_COVERAGE) - message(STATUS "Shaderc: code coverage report is on.") - if (NOT UNIX) - message(FATAL_ERROR "Code coverage on non-UNIX system not supported yet.") - endif() - if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - message(FATAL_ERROR "Code coverage with non-Debug build can be misleading.") - endif() - find_program(LCOV_EXE NAMES lcov) - if (NOT LCOV_EXE) - message(FATAL_ERROR "lcov was not found") - endif() - find_program(GENHTML_EXE NAMES genhtml) - if (NOT GENHTML_EXE) - message(FATAL_ERROR "genhtml was not found") - endif() - - set(LCOV_BASE_DIR ${CMAKE_BINARY_DIR}) - set(LCOV_INFO_FILE ${LCOV_BASE_DIR}/lcov.info) - set(COVERAGE_STAT_HTML_DIR ${LCOV_BASE_DIR}/coverage-report) - - add_custom_target(clean-coverage - # Remove all gcov .gcda files in the directory recursively. - COMMAND ${LCOV_EXE} --directory . --zerocounters -q - # Remove all lcov .info files. - COMMAND ${CMAKE_COMMAND} -E remove ${LCOV_INFO_FILE} - # Remove all html report files. - COMMAND ${CMAKE_COMMAND} -E remove_directory ${COVERAGE_STAT_HTML_DIR} - # TODO(antiagainst): the following two commands are here to remedy the - # problem of "reached unexpected end of file" experienced by lcov. - # The symptom is that some .gcno files are wrong after code change and - # recompiling. We don't know the exact reason yet. Figure it out. - # Remove all .gcno files in the directory recursively. - COMMAND ${PYTHON_EXECUTABLE} - ${shaderc_SOURCE_DIR}/utils/remove-file-by-suffix.py . ".gcno" - # .gcno files are not tracked by CMake. So no recompiling is triggered - # even if they are missing. Unfortunately, we just removed all of them - # in the above. - COMMAND ${CMAKE_COMMAND} --build . --target clean - WORKING_DIRECTORY ${LCOV_BASE_DIR} - COMMENT "Clean coverage files" - ) - - add_custom_target(report-coverage - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} - # Run all tests. - COMMAND ctest --output-on-failure - # Collect coverage data from gcov .gcda files. - COMMAND ${LCOV_EXE} --directory . --capture -o ${LCOV_INFO_FILE} - # Remove coverage info for system header files. - COMMAND ${LCOV_EXE} - --remove ${LCOV_INFO_FILE} '/usr/include/*' -o ${LCOV_INFO_FILE} - # Remove coverage info for external and third_party code. - COMMAND ${LCOV_EXE} - --remove ${LCOV_INFO_FILE} '${shaderc_SOURCE_DIR}/ext/*' - -o ${LCOV_INFO_FILE} - - COMMAND ${LCOV_EXE} - --remove ${LCOV_INFO_FILE} '${shaderc_SOURCE_DIR}/third_party/*' - -o ${LCOV_INFO_FILE} - # Remove coverage info for tests. - COMMAND ${LCOV_EXE} - --remove ${LCOV_INFO_FILE} '*_test.cc' -o ${LCOV_INFO_FILE} - # Generate html report file. - COMMAND ${GENHTML_EXE} - ${LCOV_INFO_FILE} -t "Coverage Report" -o ${COVERAGE_STAT_HTML_DIR} - DEPENDS clean-coverage - WORKING_DIRECTORY ${LCOV_BASE_DIR} - COMMENT "Collect and analyze coverage data" - ) -endif() - -option(DISABLE_RTTI "Disable RTTI in builds") -if(DISABLE_RTTI) - if(UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") - endif(UNIX) -endif(DISABLE_RTTI) - -option(DISABLE_EXCEPTIONS "Disables exceptions in builds") -if(DISABLE_EXCEPTIONS) - if(UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") - endif(UNIX) -endif(DISABLE_EXCEPTIONS) diff --git a/lib/shaderc/cmake/shaderc.pc.in b/lib/shaderc/cmake/shaderc.pc.in deleted file mode 100644 index 6d217bfcd..000000000 --- a/lib/shaderc/cmake/shaderc.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ - -Name: shaderc -Description: Tools and libraries for Vulkan shader compilation -Version: @CURRENT_VERSION@ -URL: https://github.com/google/shaderc - -Libs: -L${libdir} @LIBS@ -Cflags: -I${includedir} diff --git a/lib/shaderc/cmake/shaderc_combined.pc.in b/lib/shaderc/cmake/shaderc_combined.pc.in deleted file mode 100644 index 6d217bfcd..000000000 --- a/lib/shaderc/cmake/shaderc_combined.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ - -Name: shaderc -Description: Tools and libraries for Vulkan shader compilation -Version: @CURRENT_VERSION@ -URL: https://github.com/google/shaderc - -Libs: -L${libdir} @LIBS@ -Cflags: -I${includedir} diff --git a/lib/shaderc/cmake/shaderc_static.pc.in b/lib/shaderc/cmake/shaderc_static.pc.in deleted file mode 100644 index 6d217bfcd..000000000 --- a/lib/shaderc/cmake/shaderc_static.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ - -Name: shaderc -Description: Tools and libraries for Vulkan shader compilation -Version: @CURRENT_VERSION@ -URL: https://github.com/google/shaderc - -Libs: -L${libdir} @LIBS@ -Cflags: -I${includedir} diff --git a/lib/shaderc/cmake/utils.cmake b/lib/shaderc/cmake/utils.cmake deleted file mode 100644 index fb310db4b..000000000 --- a/lib/shaderc/cmake/utils.cmake +++ /dev/null @@ -1,229 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# utility functions - -function (shaderc_use_gmock TARGET) - target_include_directories(${TARGET} PRIVATE - ${gmock_SOURCE_DIR}/include - ${gtest_SOURCE_DIR}/include) - target_link_libraries(${TARGET} PRIVATE gmock gtest_main) -endfunction(shaderc_use_gmock) - -function(shaderc_default_c_compile_options TARGET) - if (NOT "${MSVC}") - if (SHADERC_ENABLE_WERROR_COMPILE) - target_compile_options(${TARGET} PRIVATE -Wall -Werror -fvisibility=hidden) - else() - target_compile_options(${TARGET} PRIVATE -Wall -fvisibility=hidden) - endif() - check_cxx_compiler_flag(-fPIC COMPILER_SUPPORTS_PIC) - if (NOT "${MINGW}" AND COMPILER_SUPPORTS_PIC) - target_compile_options(${TARGET} PRIVATE -fPIC) - endif() - if (ENABLE_CODE_COVERAGE) - # The --coverage option is a synonym for -fprofile-arcs -ftest-coverage - # when compiling. - target_compile_options(${TARGET} PRIVATE -g -O0 --coverage) - # The --coverage option is a synonym for -lgcov when linking for gcc. - # For clang, it links in a different library, libclang_rt.profile, which - # requires clang to be built with compiler-rt. - target_link_libraries(${TARGET} PRIVATE --coverage) - endif() - if (NOT SHADERC_ENABLE_SHARED_CRT) - if (WIN32) - # For MinGW cross compile, statically link to the libgcc runtime. - # But it still depends on MSVCRT.dll. - set_target_properties(${TARGET} PROPERTIES - LINK_FLAGS "-static -static-libgcc") - endif(WIN32) - endif(NOT SHADERC_ENABLE_SHARED_CRT) - else() - # disable warning C4800: 'int' : forcing value to bool 'true' or 'false' - # (performance warning) - target_compile_options(${TARGET} PRIVATE /wd4800) - endif() -endfunction(shaderc_default_c_compile_options) - -function(shaderc_default_compile_options TARGET) - shaderc_default_c_compile_options(${TARGET}) - if (NOT "${MSVC}") - target_compile_options(${TARGET} PRIVATE -std=c++11) - if (NOT SHADERC_ENABLE_SHARED_CRT) - if (WIN32) - # For MinGW cross compile, statically link to the C++ runtime. - # But it still depends on MSVCRT.dll. - set_target_properties(${TARGET} PROPERTIES - LINK_FLAGS "-static -static-libgcc -static-libstdc++") - endif(WIN32) - endif(NOT SHADERC_ENABLE_SHARED_CRT) - endif() -endfunction(shaderc_default_compile_options) - -# Build an asciidoc file; additional arguments past the base filename specify -# additional dependencies for the file. -function(shaderc_add_asciidoc TARGET FILE) - if (ASCIIDOCTOR_EXE) - set(DEST ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.html) - add_custom_command( - COMMAND ${ASCIIDOCTOR_EXE} -a toc -o ${DEST} - ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.asciidoc - DEPENDS ${FILE}.asciidoc ${ARGN} - OUTPUT ${DEST}) - # Create the target, but the default build target does not depend on it. - # Some Asciidoctor installations are mysteriously broken, and it's hard - # to detect those cases. Generating HTML is not critical by default. - add_custom_target(${TARGET} DEPENDS ${DEST}) - endif(ASCIIDOCTOR_EXE) -endfunction() - -# Adds a set of tests. -# This function accepts the following parameters: -# TEST_PREFIX: a prefix for each test target name -# TEST_NAMES: a list of test names where each TEST_NAME has a corresponding -# file residing at src/${TEST_NAME}_test.cc -# LINK_LIBS: (optional) a list of libraries to be linked to the test target -# INCLUDE_DIRS: (optional) a list of include directories to be searched -# for header files. -function(shaderc_add_tests) - if(${SHADERC_ENABLE_TESTS}) - cmake_parse_arguments(PARSED_ARGS - "" - "TEST_PREFIX" - "TEST_NAMES;LINK_LIBS;INCLUDE_DIRS" - ${ARGN}) - if (NOT PARSED_ARGS_TEST_NAMES) - message(FATAL_ERROR "Tests must have a target") - endif() - if (NOT PARSED_ARGS_TEST_PREFIX) - message(FATAL_ERROR "Tests must have a prefix") - endif() - foreach(TARGET ${PARSED_ARGS_TEST_NAMES}) - set(TEST_NAME ${PARSED_ARGS_TEST_PREFIX}_${TARGET}_test) - add_executable(${TEST_NAME} src/${TARGET}_test.cc) - shaderc_default_compile_options(${TEST_NAME}) - if (MINGW) - target_compile_options(${TEST_NAME} PRIVATE -DSHADERC_DISABLE_THREADED_TESTS) - endif() - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - # Disable this warning, which is useless in test code. - # Fixes https://github.com/google/shaderc/issues/334 - target_compile_options(${TEST_NAME} PRIVATE -Wno-noexcept-type) - endif() - if (PARSED_ARGS_LINK_LIBS) - target_link_libraries(${TEST_NAME} PRIVATE - ${PARSED_ARGS_LINK_LIBS}) - endif() - if (PARSED_ARGS_INCLUDE_DIRS) - target_include_directories(${TEST_NAME} PRIVATE - ${PARSED_ARGS_INCLUDE_DIRS}) - endif() - shaderc_use_gmock(${TEST_NAME}) - add_test( - NAME ${PARSED_ARGS_TEST_PREFIX}_${TARGET} - COMMAND ${TEST_NAME}) - endforeach() - endif(${SHADERC_ENABLE_TESTS}) -endfunction(shaderc_add_tests) - -# Finds all transitive static library dependencies of a given target -# including possibly the target itself. -# This will skip libraries that were statically linked that were not -# built by CMake, for example -lpthread. -macro(shaderc_get_transitive_libs target out_list) - if (TARGET ${target}) - get_target_property(libtype ${target} TYPE) - # If this target is a static library, get anything it depends on. - if ("${libtype}" STREQUAL "STATIC_LIBRARY") - # Get the original library if this is an alias library. This is - # to avoid putting both the original library and the alias library - # in the list (given we are deduplicating according to target names). - # Otherwise, we may pack the same library twice, resulting in - # duplicated symbols. - get_target_property(aliased_target ${target} ALIASED_TARGET) - if (aliased_target) - list(INSERT ${out_list} 0 "${aliased_target}") - else() - list(INSERT ${out_list} 0 "${target}") - endif() - - get_target_property(libs ${target} LINK_LIBRARIES) - if (libs) - foreach(lib ${libs}) - shaderc_get_transitive_libs(${lib} ${out_list}) - endforeach() - endif() - endif() - endif() - # If we know the location (i.e. if it was made with CMake) then we - # can add it to our list. - LIST(REMOVE_DUPLICATES ${out_list}) -endmacro() - -# Combines the static library "target" with all of its transitive static -# library dependencies into a single static library "new_target". -function(shaderc_combine_static_lib new_target target) - - set(all_libs "") - shaderc_get_transitive_libs(${target} all_libs) - - set(libname - ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${new_target}${CMAKE_STATIC_LIBRARY_SUFFIX}) - - if (MSVC) - string(REPLACE ";" ">;$") - - add_custom_command(OUTPUT ${libname} - DEPENDS ${all_libs} - COMMAND lib.exe ${lib_target_list} /OUT:${libname} /NOLOGO) - elseif(APPLE) - string(REPLACE ";" ">;$") - - if(DEFINED CCTOOLS_PREFIX) - set(apple_libtool ${CCTOOLS_PREFIX}/bin/llvm-libtool-darwin) - else() - set(apple_libtool libtool) - endif() - - add_custom_command(OUTPUT ${libname} - DEPENDS ${all_libs} - COMMAND ${apple_libtool} -static -o ${libname} ${lib_target_list}) - else() - string(REPLACE ";" "> \naddlib $") - set(build_script_file "${start_of_file}\nsave\nend\n") - - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${new_target}.ar" - CONTENT ${build_script_file} - CONDITION 1) - - add_custom_command(OUTPUT ${libname} - DEPENDS ${all_libs} - COMMAND ${CMAKE_AR} -M < ${new_target}.ar) - endif() - - add_custom_target(${new_target}_genfile ALL - DEPENDS ${libname}) - - # CMake needs to be able to see this as another normal library, - # so import the newly created library as an imported library, - # and set up the dependencies on the custom target. - add_library(${new_target} STATIC IMPORTED) - set_target_properties(${new_target} - PROPERTIES IMPORTED_LOCATION ${libname}) - add_dependencies(${new_target} ${new_target}_genfile) -endfunction() diff --git a/lib/shaderc/cmake/write_pkg_config.cmake b/lib/shaderc/cmake/write_pkg_config.cmake deleted file mode 100644 index d367ce3e4..000000000 --- a/lib/shaderc/cmake/write_pkg_config.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2017 Pierre Moreau -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# First, retrieve the current version from CHANGES -file(STRINGS ${CHANGES_FILE} CHANGES_CONTENT) -string( -REGEX - MATCH "v[0-9]+(.[0-9]+)?(-dev)? [0-9]+-[0-9]+-[0-9]+" - FIRST_VERSION_LINE - ${CHANGES_CONTENT}) -string( -REGEX - REPLACE "^v([^ ]+) .+$" "\\1" - CURRENT_VERSION - "${FIRST_VERSION_LINE}") -# If this is a development version, replace "-dev" by ".0" as pkg-config nor -# CMake support "-dev" in the version. -# If it's not a "-dev" version then ensure it ends with ".1" -string(REGEX REPLACE "-dev.1" ".0" CURRENT_VERSION "${CURRENT_VERSION}.1") -configure_file(${TEMPLATE_FILE} ${OUT_FILE} @ONLY) diff --git a/lib/shaderc/downloads.md b/lib/shaderc/downloads.md deleted file mode 100644 index 17386683b..000000000 --- a/lib/shaderc/downloads.md +++ /dev/null @@ -1,17 +0,0 @@ -# Downloads -Download the latest builds. - -**Note: These binaries are just the artifacts of the builders and have not - undergone any QA, thus they should be considered unsupported.** - -## Release -| Windows | Linux | MacOS | -| --- | --- | --- | -| [MSVC 2017](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2017_release.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_release.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_release.html) | -| [MSVC 2015](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2015_release.html) | [gcc](https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_release.html) | | - -## Debug -| Windows | Linux | MacOS | -| --- | --- | --- | -| [MSVC 2017](https://storage.googleapis.com/shaderc/badges/build_link_windows_vs2017_debug.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_linux_clang_debug.html) | [clang](https://storage.googleapis.com/shaderc/badges/build_link_macos_clang_debug.html) | -| | [gcc](https://storage.googleapis.com/shaderc/badges/build_link_linux_gcc_debug.html) | | diff --git a/lib/shaderc/libshaderc/Android.mk b/lib/shaderc/libshaderc/Android.mk deleted file mode 100644 index 294af69f8..000000000 --- a/lib/shaderc/libshaderc/Android.mk +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_CPP_EXTENSION := .cc .cpp .cxx -LOCAL_MODULE:=shaderc -LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/include -LOCAL_SRC_FILES:=src/shaderc.cc -# The Shaderc third_party/Android.mk deduces SPVHEADERS_LOCAL_PATH, -# or delegates that responsibility to SPIRV-Tools' Android.mk. -LOCAL_C_INCLUDES:=$(LOCAL_PATH)/include $(SPVHEADERS_LOCAL_PATH)/include -LOCAL_STATIC_LIBRARIES:=shaderc_util SPIRV-Tools-opt -LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -DENABLE_HLSL=1 -LOCAL_EXPORT_CPPFLAGS:=-std=c++11 -LOCAL_EXPORT_LDFLAGS:=-latomic -include $(BUILD_STATIC_LIBRARY) diff --git a/lib/shaderc/libshaderc/CMakeLists.txt b/lib/shaderc/libshaderc/CMakeLists.txt deleted file mode 100644 index 79b5d744b..000000000 --- a/lib/shaderc/libshaderc/CMakeLists.txt +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project(libshaderc) - -# Even though shaderc.hpp is a headers-only library, adding -# a dependency here will force clients of the library to rebuild -# when it changes. -set(SHADERC_SOURCES - include/shaderc/shaderc.h - include/shaderc/shaderc.hpp - src/shaderc.cc - src/shaderc_private.h -) - -add_library(shaderc STATIC ${SHADERC_SOURCES}) -shaderc_default_compile_options(shaderc) -target_include_directories(shaderc - PUBLIC include - PRIVATE ${glslang_SOURCE_DIR} - ${SPIRV-Headers_SOURCE_DIR}/include) - -#add_library(shaderc_shared SHARED ${SHADERC_SOURCES}) -#shaderc_default_compile_options(shaderc_shared) -#target_include_directories(shaderc_shared -# PUBLIC include -# PRIVATE ${glslang_SOURCE_DIR} -# ${SPIRV-Headers_SOURCE_DIR}/include) -#target_compile_definitions(shaderc_shared -# PRIVATE SHADERC_IMPLEMENTATION -# PUBLIC SHADERC_SHAREDLIB -#) -#set_target_properties(shaderc_shared PROPERTIES SOVERSION 1) - -if(SHADERC_ENABLE_INSTALL) - install( - FILES - include/shaderc/env.h - include/shaderc/status.h - include/shaderc/visibility.h - include/shaderc/shaderc.h - include/shaderc/shaderc.hpp - DESTINATION - ${CMAKE_INSTALL_INCLUDEDIR}/shaderc) - -# install(TARGETS shaderc shaderc_shared -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -endif(SHADERC_ENABLE_INSTALL) - -find_package(Threads) -set(SHADERC_LIBS - glslang OSDependent OGLCompiler glslang ${CMAKE_THREAD_LIBS_INIT} - shaderc_util - SPIRV # from glslang - SPIRV-Tools -) - -target_link_libraries(shaderc PRIVATE ${SHADERC_LIBS}) -#target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS}) - -shaderc_add_tests( - TEST_PREFIX shaderc - LINK_LIBS shaderc - INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} - ${spirv-tools_SOURCE_DIR}/include - ${SPIRV-Headers_SOURCE_DIR}/include - TEST_NAMES - shaderc - shaderc_cpp - shaderc_private) - -#shaderc_add_tests( -# TEST_PREFIX shaderc_shared -# LINK_LIBS shaderc_shared SPIRV-Tools -# INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} -# ${spirv-tools_SOURCE_DIR}/include -# ${SPIRV-Headers_SOURCE_DIR}/include -# TEST_NAMES -# shaderc -# shaderc_cpp -# shaderc_private) - -shaderc_combine_static_lib(shaderc_combined shaderc) - -if(SHADERC_ENABLE_INSTALL) - # Since shaderc_combined is defined as an imported library, we cannot use the - # install() directive to install it. Install it like a normal file. - get_target_property(generated_location shaderc_combined LOCATION) - string(REGEX MATCH "Visual Studio .*" vs_generator "${CMAKE_GENERATOR}") - if (NOT "${vs_generator}" STREQUAL "") - # With Visual Studio generators, the LOCATION property is not properly - # expanded according to the current build configuration. We need to work - # around this problem by manually substitution. - string(REPLACE "$(Configuration)" "\${CMAKE_INSTALL_CONFIG_NAME}" - install_location "${generated_location}") - install(FILES ${install_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) - else() - install(FILES ${generated_location} DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() -endif(SHADERC_ENABLE_INSTALL) - -shaderc_add_tests( - TEST_PREFIX shaderc_combined - LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT} - INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR} - ${spirv-tools_SOURCE_DIR}/include - ${SPIRV-Headers_SOURCE_DIR}/include - TEST_NAMES - shaderc - shaderc_cpp) - -if(${SHADERC_ENABLE_TESTS}) - add_executable(shaderc_c_smoke_test ./src/shaderc_c_smoke_test.c) - shaderc_default_c_compile_options(shaderc_c_smoke_test) - target_include_directories(shaderc_c_smoke_test PUBLIC ${shaderc_SOURCE_DIR}/libshaderc_util/include) - target_link_libraries(shaderc_c_smoke_test PRIVATE shaderc) - add_test(NAME shaderc_c_smoke_test COMMAND shaderc_c_smoke_test) -endif() diff --git a/lib/shaderc/libshaderc/README.md b/lib/shaderc/libshaderc/README.md deleted file mode 100644 index bf9d317f3..000000000 --- a/lib/shaderc/libshaderc/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# libshaderc - -A library for compiling shader strings into SPIR-V. - -## Build Artifacts - -There are two main shaderc libraries that are created during a CMake -compilation. The first is `libshaderc`, which is a static library -containing just the functionality exposed by libshaderc. It depends -on other compilation targets `glslang`, `OSDependent`, `OGLCompiler`, -`shaderc_util`, `SPIRV`, `HLSL`, `SPIRV-Tools`, and `SPIRV-Tools-opt`. - -The other is `libshaderc_combined`, which is a static library containing -libshaderc and all of its dependencies. - - -## Integrating libshaderc - -There are several ways of integrating libshaderc into external projects. - -1. If the external project uses CMake, then `shaderc/CMakeLists.txt` can be -included into the external project's CMake configuration and shaderc can be used -as a link target. -This is the simplest way to use libshaderc in an external project. - -2. If the external project uses CMake and is building for Linux or Android, -`target_link_libraries(shaderc_combined)` can instead be specified. This is -functionally identical to the previous option. - -3. If the external project does not use CMake, then the external project can -instead directly use the generated libraries. `shaderc/libshaderc/include` -should be added to the include path, and -`build/libshaderc/libshaderc_combined.a` should be linked. Note that on some -platforms `-lpthread` should also be specified. - -4. If the external project does not use CMake and cannot use -`libshaderc_combined`, the following libraries or their platform-dependent -counterparts should be linked in the order specified. - * `build/libshaderc/libshaderc.a` - * `build/third_party/glslang/glslang/glslang.a` - * `build/third_party/glslang/glslang/OSDependent/{Platform}/libOSDependent.a` - * `build/third_party/glslang/OGLCompilersDLL/libOGLCompiler.a` - * `build/third_party/glslang/libglslang.a` - * `build/shaderc_util/libshaderc_util.a` - * `build/third_party/glslang/SPIRV/libSPIRV.a` - * `build/third_party/glslang/hlsl/libHLSL.a` - * `build/third_party/spirv-tools/libSPIRV-Tools-opt.a` - * `build/third_party/spirv-tools/libSPIRV-Tools.a` - -5. If building for Android using the Android NDK, `shaderc/Android.mk` can be -included in the application's `Android.mk` and `LOCAL_STATIC_LIBRARIES:=shaderc` -can be specified. See `shaderc/android_test` for an example. diff --git a/lib/shaderc/libshaderc/include/shaderc/env.h b/lib/shaderc/libshaderc/include/shaderc/env.h deleted file mode 100644 index 14b418dcd..000000000 --- a/lib/shaderc/libshaderc/include/shaderc/env.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2018 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SHADERC_ENV_H_ -#define SHADERC_ENV_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - shaderc_target_env_vulkan, // SPIR-V under Vulkan semantics - shaderc_target_env_opengl, // SPIR-V under OpenGL semantics - // NOTE: SPIR-V code generation is not supported for shaders under OpenGL - // compatibility profile. - shaderc_target_env_opengl_compat, // SPIR-V under OpenGL semantics, - // including compatibility profile - // functions - shaderc_target_env_webgpu, // Deprecated, SPIR-V under WebGPU - // semantics - shaderc_target_env_default = shaderc_target_env_vulkan -} shaderc_target_env; - -typedef enum { - // For Vulkan, use Vulkan's mapping of version numbers to integers. - // See vulkan.h - shaderc_env_version_vulkan_1_0 = ((1u << 22)), - shaderc_env_version_vulkan_1_1 = ((1u << 22) | (1 << 12)), - shaderc_env_version_vulkan_1_2 = ((1u << 22) | (2 << 12)), - shaderc_env_version_vulkan_1_3 = ((1u << 22) | (3 << 12)), - // For OpenGL, use the number from #version in shaders. - // TODO(dneto): Currently no difference between OpenGL 4.5 and 4.6. - // See glslang/Standalone/Standalone.cpp - // TODO(dneto): Glslang doesn't accept a OpenGL client version of 460. - shaderc_env_version_opengl_4_5 = 450, - shaderc_env_version_webgpu, // Deprecated, WebGPU env never defined versions -} shaderc_env_version; - -// The known versions of SPIR-V. -typedef enum { - // Use the values used for word 1 of a SPIR-V binary: - // - bits 24 to 31: zero - // - bits 16 to 23: major version number - // - bits 8 to 15: minor version number - // - bits 0 to 7: zero - shaderc_spirv_version_1_0 = 0x010000u, - shaderc_spirv_version_1_1 = 0x010100u, - shaderc_spirv_version_1_2 = 0x010200u, - shaderc_spirv_version_1_3 = 0x010300u, - shaderc_spirv_version_1_4 = 0x010400u, - shaderc_spirv_version_1_5 = 0x010500u, - shaderc_spirv_version_1_6 = 0x010600u -} shaderc_spirv_version; - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // SHADERC_ENV_H_ diff --git a/lib/shaderc/libshaderc/include/shaderc/shaderc.h b/lib/shaderc/libshaderc/include/shaderc/shaderc.h deleted file mode 100644 index 1bc354d9a..000000000 --- a/lib/shaderc/libshaderc/include/shaderc/shaderc.h +++ /dev/null @@ -1,585 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SHADERC_SHADERC_H_ -#define SHADERC_SHADERC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include "shaderc/env.h" -#include "shaderc/status.h" -#include "shaderc/visibility.h" - -// Source language kind. -typedef enum { - shaderc_source_language_glsl, - shaderc_source_language_hlsl, -} shaderc_source_language; - -typedef enum { - // Forced shader kinds. These shader kinds force the compiler to compile the - // source code as the specified kind of shader. - shaderc_vertex_shader, - shaderc_fragment_shader, - shaderc_compute_shader, - shaderc_geometry_shader, - shaderc_tess_control_shader, - shaderc_tess_evaluation_shader, - - shaderc_glsl_vertex_shader = shaderc_vertex_shader, - shaderc_glsl_fragment_shader = shaderc_fragment_shader, - shaderc_glsl_compute_shader = shaderc_compute_shader, - shaderc_glsl_geometry_shader = shaderc_geometry_shader, - shaderc_glsl_tess_control_shader = shaderc_tess_control_shader, - shaderc_glsl_tess_evaluation_shader = shaderc_tess_evaluation_shader, - - // Deduce the shader kind from #pragma annotation in the source code. Compiler - // will emit error if #pragma annotation is not found. - shaderc_glsl_infer_from_source, - // Default shader kinds. Compiler will fall back to compile the source code as - // the specified kind of shader when #pragma annotation is not found in the - // source code. - shaderc_glsl_default_vertex_shader, - shaderc_glsl_default_fragment_shader, - shaderc_glsl_default_compute_shader, - shaderc_glsl_default_geometry_shader, - shaderc_glsl_default_tess_control_shader, - shaderc_glsl_default_tess_evaluation_shader, - shaderc_spirv_assembly, - shaderc_raygen_shader, - shaderc_anyhit_shader, - shaderc_closesthit_shader, - shaderc_miss_shader, - shaderc_intersection_shader, - shaderc_callable_shader, - shaderc_glsl_raygen_shader = shaderc_raygen_shader, - shaderc_glsl_anyhit_shader = shaderc_anyhit_shader, - shaderc_glsl_closesthit_shader = shaderc_closesthit_shader, - shaderc_glsl_miss_shader = shaderc_miss_shader, - shaderc_glsl_intersection_shader = shaderc_intersection_shader, - shaderc_glsl_callable_shader = shaderc_callable_shader, - shaderc_glsl_default_raygen_shader, - shaderc_glsl_default_anyhit_shader, - shaderc_glsl_default_closesthit_shader, - shaderc_glsl_default_miss_shader, - shaderc_glsl_default_intersection_shader, - shaderc_glsl_default_callable_shader, - shaderc_task_shader, - shaderc_mesh_shader, - shaderc_glsl_task_shader = shaderc_task_shader, - shaderc_glsl_mesh_shader = shaderc_mesh_shader, - shaderc_glsl_default_task_shader, - shaderc_glsl_default_mesh_shader, -} shaderc_shader_kind; - -typedef enum { - shaderc_profile_none, // Used if and only if GLSL version did not specify - // profiles. - shaderc_profile_core, - shaderc_profile_compatibility, // Disabled. This generates an error - shaderc_profile_es, -} shaderc_profile; - -// Optimization level. -typedef enum { - shaderc_optimization_level_zero, // no optimization - shaderc_optimization_level_size, // optimize towards reducing code size - shaderc_optimization_level_performance, // optimize towards performance -} shaderc_optimization_level; - -// Resource limits. -typedef enum { - shaderc_limit_max_lights, - shaderc_limit_max_clip_planes, - shaderc_limit_max_texture_units, - shaderc_limit_max_texture_coords, - shaderc_limit_max_vertex_attribs, - shaderc_limit_max_vertex_uniform_components, - shaderc_limit_max_varying_floats, - shaderc_limit_max_vertex_texture_image_units, - shaderc_limit_max_combined_texture_image_units, - shaderc_limit_max_texture_image_units, - shaderc_limit_max_fragment_uniform_components, - shaderc_limit_max_draw_buffers, - shaderc_limit_max_vertex_uniform_vectors, - shaderc_limit_max_varying_vectors, - shaderc_limit_max_fragment_uniform_vectors, - shaderc_limit_max_vertex_output_vectors, - shaderc_limit_max_fragment_input_vectors, - shaderc_limit_min_program_texel_offset, - shaderc_limit_max_program_texel_offset, - shaderc_limit_max_clip_distances, - shaderc_limit_max_compute_work_group_count_x, - shaderc_limit_max_compute_work_group_count_y, - shaderc_limit_max_compute_work_group_count_z, - shaderc_limit_max_compute_work_group_size_x, - shaderc_limit_max_compute_work_group_size_y, - shaderc_limit_max_compute_work_group_size_z, - shaderc_limit_max_compute_uniform_components, - shaderc_limit_max_compute_texture_image_units, - shaderc_limit_max_compute_image_uniforms, - shaderc_limit_max_compute_atomic_counters, - shaderc_limit_max_compute_atomic_counter_buffers, - shaderc_limit_max_varying_components, - shaderc_limit_max_vertex_output_components, - shaderc_limit_max_geometry_input_components, - shaderc_limit_max_geometry_output_components, - shaderc_limit_max_fragment_input_components, - shaderc_limit_max_image_units, - shaderc_limit_max_combined_image_units_and_fragment_outputs, - shaderc_limit_max_combined_shader_output_resources, - shaderc_limit_max_image_samples, - shaderc_limit_max_vertex_image_uniforms, - shaderc_limit_max_tess_control_image_uniforms, - shaderc_limit_max_tess_evaluation_image_uniforms, - shaderc_limit_max_geometry_image_uniforms, - shaderc_limit_max_fragment_image_uniforms, - shaderc_limit_max_combined_image_uniforms, - shaderc_limit_max_geometry_texture_image_units, - shaderc_limit_max_geometry_output_vertices, - shaderc_limit_max_geometry_total_output_components, - shaderc_limit_max_geometry_uniform_components, - shaderc_limit_max_geometry_varying_components, - shaderc_limit_max_tess_control_input_components, - shaderc_limit_max_tess_control_output_components, - shaderc_limit_max_tess_control_texture_image_units, - shaderc_limit_max_tess_control_uniform_components, - shaderc_limit_max_tess_control_total_output_components, - shaderc_limit_max_tess_evaluation_input_components, - shaderc_limit_max_tess_evaluation_output_components, - shaderc_limit_max_tess_evaluation_texture_image_units, - shaderc_limit_max_tess_evaluation_uniform_components, - shaderc_limit_max_tess_patch_components, - shaderc_limit_max_patch_vertices, - shaderc_limit_max_tess_gen_level, - shaderc_limit_max_viewports, - shaderc_limit_max_vertex_atomic_counters, - shaderc_limit_max_tess_control_atomic_counters, - shaderc_limit_max_tess_evaluation_atomic_counters, - shaderc_limit_max_geometry_atomic_counters, - shaderc_limit_max_fragment_atomic_counters, - shaderc_limit_max_combined_atomic_counters, - shaderc_limit_max_atomic_counter_bindings, - shaderc_limit_max_vertex_atomic_counter_buffers, - shaderc_limit_max_tess_control_atomic_counter_buffers, - shaderc_limit_max_tess_evaluation_atomic_counter_buffers, - shaderc_limit_max_geometry_atomic_counter_buffers, - shaderc_limit_max_fragment_atomic_counter_buffers, - shaderc_limit_max_combined_atomic_counter_buffers, - shaderc_limit_max_atomic_counter_buffer_size, - shaderc_limit_max_transform_feedback_buffers, - shaderc_limit_max_transform_feedback_interleaved_components, - shaderc_limit_max_cull_distances, - shaderc_limit_max_combined_clip_and_cull_distances, - shaderc_limit_max_samples, -} shaderc_limit; - -// Uniform resource kinds. -// In Vulkan, uniform resources are bound to the pipeline via descriptors -// with numbered bindings and sets. -typedef enum { - // Image and image buffer. - shaderc_uniform_kind_image, - // Pure sampler. - shaderc_uniform_kind_sampler, - // Sampled texture in GLSL, and Shader Resource View in HLSL. - shaderc_uniform_kind_texture, - // Uniform Buffer Object (UBO) in GLSL. Cbuffer in HLSL. - shaderc_uniform_kind_buffer, - // Shader Storage Buffer Object (SSBO) in GLSL. - shaderc_uniform_kind_storage_buffer, - // Unordered Access View, in HLSL. (Writable storage image or storage - // buffer.) - shaderc_uniform_kind_unordered_access_view, -} shaderc_uniform_kind; - -// Usage examples: -// -// Aggressively release compiler resources, but spend time in initialization -// for each new use. -// shaderc_compiler_t compiler = shaderc_compiler_initialize(); -// shaderc_compilation_result_t result = shaderc_compile_into_spv( -// compiler, "#version 450\nvoid main() {}", 27, -// shaderc_glsl_vertex_shader, "main.vert", "main", nullptr); -// // Do stuff with compilation results. -// shaderc_result_release(result); -// shaderc_compiler_release(compiler); -// -// Keep the compiler object around for a long time, but pay for extra space -// occupied. -// shaderc_compiler_t compiler = shaderc_compiler_initialize(); -// // On the same, other or multiple simultaneous threads. -// shaderc_compilation_result_t result = shaderc_compile_into_spv( -// compiler, "#version 450\nvoid main() {}", 27, -// shaderc_glsl_vertex_shader, "main.vert", "main", nullptr); -// // Do stuff with compilation results. -// shaderc_result_release(result); -// // Once no more compilations are to happen. -// shaderc_compiler_release(compiler); - -// An opaque handle to an object that manages all compiler state. -typedef struct shaderc_compiler* shaderc_compiler_t; - -// Returns a shaderc_compiler_t that can be used to compile modules. -// A return of NULL indicates that there was an error initializing the compiler. -// Any function operating on shaderc_compiler_t must offer the basic -// thread-safety guarantee. -// [http://herbsutter.com/2014/01/13/gotw-95-solution-thread-safety-and-synchronization/] -// That is: concurrent invocation of these functions on DIFFERENT objects needs -// no synchronization; concurrent invocation of these functions on the SAME -// object requires synchronization IF AND ONLY IF some of them take a non-const -// argument. -SHADERC_EXPORT shaderc_compiler_t shaderc_compiler_initialize(void); - -// Releases the resources held by the shaderc_compiler_t. -// After this call it is invalid to make any future calls to functions -// involving this shaderc_compiler_t. -SHADERC_EXPORT void shaderc_compiler_release(shaderc_compiler_t); - -// An opaque handle to an object that manages options to a single compilation -// result. -typedef struct shaderc_compile_options* shaderc_compile_options_t; - -// Returns a default-initialized shaderc_compile_options_t that can be used -// to modify the functionality of a compiled module. -// A return of NULL indicates that there was an error initializing the options. -// Any function operating on shaderc_compile_options_t must offer the -// basic thread-safety guarantee. -SHADERC_EXPORT shaderc_compile_options_t - shaderc_compile_options_initialize(void); - -// Returns a copy of the given shaderc_compile_options_t. -// If NULL is passed as the parameter the call is the same as -// shaderc_compile_options_init. -SHADERC_EXPORT shaderc_compile_options_t shaderc_compile_options_clone( - const shaderc_compile_options_t options); - -// Releases the compilation options. It is invalid to use the given -// shaderc_compile_options_t object in any future calls. It is safe to pass -// NULL to this function, and doing such will have no effect. -SHADERC_EXPORT void shaderc_compile_options_release( - shaderc_compile_options_t options); - -// Adds a predefined macro to the compilation options. This has the same -// effect as passing -Dname=value to the command-line compiler. If value -// is NULL, it has the same effect as passing -Dname to the command-line -// compiler. If a macro definition with the same name has previously been -// added, the value is replaced with the new value. The macro name and -// value are passed in with char pointers, which point to their data, and -// the lengths of their data. The strings that the name and value pointers -// point to must remain valid for the duration of the call, but can be -// modified or deleted after this function has returned. In case of adding -// a valueless macro, the value argument should be a null pointer or the -// value_length should be 0u. -SHADERC_EXPORT void shaderc_compile_options_add_macro_definition( - shaderc_compile_options_t options, const char* name, size_t name_length, - const char* value, size_t value_length); - -// Sets the source language. The default is GLSL. -SHADERC_EXPORT void shaderc_compile_options_set_source_language( - shaderc_compile_options_t options, shaderc_source_language lang); - -// Sets the compiler mode to generate debug information in the output. -SHADERC_EXPORT void shaderc_compile_options_set_generate_debug_info( - shaderc_compile_options_t options); - -// Sets the compiler optimization level to the given level. Only the last one -// takes effect if multiple calls of this function exist. -SHADERC_EXPORT void shaderc_compile_options_set_optimization_level( - shaderc_compile_options_t options, shaderc_optimization_level level); - -// Forces the GLSL language version and profile to a given pair. The version -// number is the same as would appear in the #version annotation in the source. -// Version and profile specified here overrides the #version annotation in the -// source. Use profile: 'shaderc_profile_none' for GLSL versions that do not -// define profiles, e.g. versions below 150. -SHADERC_EXPORT void shaderc_compile_options_set_forced_version_profile( - shaderc_compile_options_t options, int version, shaderc_profile profile); - -// Source text inclusion via #include is supported with a pair of callbacks -// to an "includer" on the client side. The first callback processes an -// inclusion request, and returns an include result. The includer owns -// the contents of the result, and those contents must remain valid until the -// second callback is invoked to release the result. Both callbacks take a -// user_data argument to specify the client context. -// To return an error, set the source_name to an empty string and put your -// error message in content. - -// An include result. -typedef struct shaderc_include_result { - // The name of the source file. The name should be fully resolved - // in the sense that it should be a unique name in the context of the - // includer. For example, if the includer maps source names to files in - // a filesystem, then this name should be the absolute path of the file. - // For a failed inclusion, this string is empty. - const char* source_name; - size_t source_name_length; - // The text contents of the source file in the normal case. - // For a failed inclusion, this contains the error message. - const char* content; - size_t content_length; - // User data to be passed along with this request. - void* user_data; -} shaderc_include_result; - -// The kinds of include requests. -enum shaderc_include_type { - shaderc_include_type_relative, // E.g. #include "source" - shaderc_include_type_standard // E.g. #include -}; - -// An includer callback type for mapping an #include request to an include -// result. The user_data parameter specifies the client context. The -// requested_source parameter specifies the name of the source being requested. -// The type parameter specifies the kind of inclusion request being made. -// The requesting_source parameter specifies the name of the source containing -// the #include request. The includer owns the result object and its contents, -// and both must remain valid until the release callback is called on the result -// object. -typedef shaderc_include_result* (*shaderc_include_resolve_fn)( - void* user_data, const char* requested_source, int type, - const char* requesting_source, size_t include_depth); - -// An includer callback type for destroying an include result. -typedef void (*shaderc_include_result_release_fn)( - void* user_data, shaderc_include_result* include_result); - -// Sets includer callback functions. -SHADERC_EXPORT void shaderc_compile_options_set_include_callbacks( - shaderc_compile_options_t options, shaderc_include_resolve_fn resolver, - shaderc_include_result_release_fn result_releaser, void* user_data); - -// Sets the compiler mode to suppress warnings, overriding warnings-as-errors -// mode. When both suppress-warnings and warnings-as-errors modes are -// turned on, warning messages will be inhibited, and will not be emitted -// as error messages. -SHADERC_EXPORT void shaderc_compile_options_set_suppress_warnings( - shaderc_compile_options_t options); - -// Sets the target shader environment, affecting which warnings or errors will -// be issued. The version will be for distinguishing between different versions -// of the target environment. The version value should be either 0 or -// a value listed in shaderc_env_version. The 0 value maps to Vulkan 1.0 if -// |target| is Vulkan, and it maps to OpenGL 4.5 if |target| is OpenGL. -SHADERC_EXPORT void shaderc_compile_options_set_target_env( - shaderc_compile_options_t options, - shaderc_target_env target, - uint32_t version); - -// Sets the target SPIR-V version. The generated module will use this version -// of SPIR-V. Each target environment determines what versions of SPIR-V -// it can consume. Defaults to the highest version of SPIR-V 1.0 which is -// required to be supported by the target environment. E.g. Default to SPIR-V -// 1.0 for Vulkan 1.0 and SPIR-V 1.3 for Vulkan 1.1. -SHADERC_EXPORT void shaderc_compile_options_set_target_spirv( - shaderc_compile_options_t options, shaderc_spirv_version version); - -// Sets the compiler mode to treat all warnings as errors. Note the -// suppress-warnings mode overrides this option, i.e. if both -// warning-as-errors and suppress-warnings modes are set, warnings will not -// be emitted as error messages. -SHADERC_EXPORT void shaderc_compile_options_set_warnings_as_errors( - shaderc_compile_options_t options); - -// Sets a resource limit. -SHADERC_EXPORT void shaderc_compile_options_set_limit( - shaderc_compile_options_t options, shaderc_limit limit, int value); - -// Sets whether the compiler should automatically assign bindings to uniforms -// that aren't already explicitly bound in the shader source. -SHADERC_EXPORT void shaderc_compile_options_set_auto_bind_uniforms( - shaderc_compile_options_t options, bool auto_bind); - -// Sets whether the compiler should automatically remove sampler variables -// and convert image variables to combined image-sampler variables. -SHADERC_EXPORT void shaderc_compile_options_set_auto_combined_image_sampler( - shaderc_compile_options_t options, bool upgrade); - -// Sets whether the compiler should use HLSL IO mapping rules for bindings. -// Defaults to false. -SHADERC_EXPORT void shaderc_compile_options_set_hlsl_io_mapping( - shaderc_compile_options_t options, bool hlsl_iomap); - -// Sets whether the compiler should determine block member offsets using HLSL -// packing rules instead of standard GLSL rules. Defaults to false. Only -// affects GLSL compilation. HLSL rules are always used when compiling HLSL. -SHADERC_EXPORT void shaderc_compile_options_set_hlsl_offsets( - shaderc_compile_options_t options, bool hlsl_offsets); - -// Sets the base binding number used for for a uniform resource type when -// automatically assigning bindings. For GLSL compilation, sets the lowest -// automatically assigned number. For HLSL compilation, the regsiter number -// assigned to the resource is added to this specified base. -SHADERC_EXPORT void shaderc_compile_options_set_binding_base( - shaderc_compile_options_t options, - shaderc_uniform_kind kind, - uint32_t base); - -// Like shaderc_compile_options_set_binding_base, but only takes effect when -// compiling a given shader stage. The stage is assumed to be one of vertex, -// fragment, tessellation evaluation, tesselation control, geometry, or compute. -SHADERC_EXPORT void shaderc_compile_options_set_binding_base_for_stage( - shaderc_compile_options_t options, shaderc_shader_kind shader_kind, - shaderc_uniform_kind kind, uint32_t base); - -// Sets whether the compiler should automatically assign locations to -// uniform variables that don't have explicit locations in the shader source. -SHADERC_EXPORT void shaderc_compile_options_set_auto_map_locations( - shaderc_compile_options_t options, bool auto_map); - -// Sets a descriptor set and binding for an HLSL register in the given stage. -// This method keeps a copy of the string data. -SHADERC_EXPORT void shaderc_compile_options_set_hlsl_register_set_and_binding_for_stage( - shaderc_compile_options_t options, shaderc_shader_kind shader_kind, - const char* reg, const char* set, const char* binding); - -// Like shaderc_compile_options_set_hlsl_register_set_and_binding_for_stage, -// but affects all shader stages. -SHADERC_EXPORT void shaderc_compile_options_set_hlsl_register_set_and_binding( - shaderc_compile_options_t options, const char* reg, const char* set, - const char* binding); - -// Sets whether the compiler should enable extension -// SPV_GOOGLE_hlsl_functionality1. -SHADERC_EXPORT void shaderc_compile_options_set_hlsl_functionality1( - shaderc_compile_options_t options, bool enable); - -// Sets whether the compiler should invert position.Y output in vertex shader. -SHADERC_EXPORT void shaderc_compile_options_set_invert_y( - shaderc_compile_options_t options, bool enable); - -// Sets whether the compiler generates code for max and min builtins which, -// if given a NaN operand, will return the other operand. Similarly, the clamp -// builtin will favour the non-NaN operands, as if clamp were implemented -// as a composition of max and min. -SHADERC_EXPORT void shaderc_compile_options_set_nan_clamp( - shaderc_compile_options_t options, bool enable); - -// An opaque handle to the results of a call to any shaderc_compile_into_*() -// function. -typedef struct shaderc_compilation_result* shaderc_compilation_result_t; - -// Takes a GLSL source string and the associated shader kind, input file -// name, compiles it according to the given additional_options. If the shader -// kind is not set to a specified kind, but shaderc_glslc_infer_from_source, -// the compiler will try to deduce the shader kind from the source -// string and a failure in deducing will generate an error. Currently only -// #pragma annotation is supported. If the shader kind is set to one of the -// default shader kinds, the compiler will fall back to the default shader -// kind in case it failed to deduce the shader kind from source string. -// The input_file_name is a null-termintated string. It is used as a tag to -// identify the source string in cases like emitting error messages. It -// doesn't have to be a 'file name'. -// The source string will be compiled into SPIR-V binary and a -// shaderc_compilation_result will be returned to hold the results. -// The entry_point_name null-terminated string defines the name of the entry -// point to associate with this GLSL source. If the additional_options -// parameter is not null, then the compilation is modified by any options -// present. May be safely called from multiple threads without explicit -// synchronization. If there was failure in allocating the compiler object, -// null will be returned. -SHADERC_EXPORT shaderc_compilation_result_t shaderc_compile_into_spv( - const shaderc_compiler_t compiler, const char* source_text, - size_t source_text_size, shaderc_shader_kind shader_kind, - const char* input_file_name, const char* entry_point_name, - const shaderc_compile_options_t additional_options); - -// Like shaderc_compile_into_spv, but the result contains SPIR-V assembly text -// instead of a SPIR-V binary module. The SPIR-V assembly syntax is as defined -// by the SPIRV-Tools open source project. -SHADERC_EXPORT shaderc_compilation_result_t shaderc_compile_into_spv_assembly( - const shaderc_compiler_t compiler, const char* source_text, - size_t source_text_size, shaderc_shader_kind shader_kind, - const char* input_file_name, const char* entry_point_name, - const shaderc_compile_options_t additional_options); - -// Like shaderc_compile_into_spv, but the result contains preprocessed source -// code instead of a SPIR-V binary module -SHADERC_EXPORT shaderc_compilation_result_t shaderc_compile_into_preprocessed_text( - const shaderc_compiler_t compiler, const char* source_text, - size_t source_text_size, shaderc_shader_kind shader_kind, - const char* input_file_name, const char* entry_point_name, - const shaderc_compile_options_t additional_options); - -// Takes an assembly string of the format defined in the SPIRV-Tools project -// (https://github.com/KhronosGroup/SPIRV-Tools/blob/master/syntax.md), -// assembles it into SPIR-V binary and a shaderc_compilation_result will be -// returned to hold the results. -// The assembling will pick options suitable for assembling specified in the -// additional_options parameter. -// May be safely called from multiple threads without explicit synchronization. -// If there was failure in allocating the compiler object, null will be -// returned. -SHADERC_EXPORT shaderc_compilation_result_t shaderc_assemble_into_spv( - const shaderc_compiler_t compiler, const char* source_assembly, - size_t source_assembly_size, - const shaderc_compile_options_t additional_options); - -// The following functions, operating on shaderc_compilation_result_t objects, -// offer only the basic thread-safety guarantee. - -// Releases the resources held by the result object. It is invalid to use the -// result object for any further operations. -SHADERC_EXPORT void shaderc_result_release(shaderc_compilation_result_t result); - -// Returns the number of bytes of the compilation output data in a result -// object. -SHADERC_EXPORT size_t shaderc_result_get_length(const shaderc_compilation_result_t result); - -// Returns the number of warnings generated during the compilation. -SHADERC_EXPORT size_t shaderc_result_get_num_warnings( - const shaderc_compilation_result_t result); - -// Returns the number of errors generated during the compilation. -SHADERC_EXPORT size_t shaderc_result_get_num_errors(const shaderc_compilation_result_t result); - -// Returns the compilation status, indicating whether the compilation succeeded, -// or failed due to some reasons, like invalid shader stage or compilation -// errors. -SHADERC_EXPORT shaderc_compilation_status shaderc_result_get_compilation_status( - const shaderc_compilation_result_t); - -// Returns a pointer to the start of the compilation output data bytes, either -// SPIR-V binary or char string. When the source string is compiled into SPIR-V -// binary, this is guaranteed to be castable to a uint32_t*. If the result -// contains assembly text or preprocessed source text, the pointer will point to -// the resulting array of characters. -SHADERC_EXPORT const char* shaderc_result_get_bytes(const shaderc_compilation_result_t result); - -// Returns a null-terminated string that contains any error messages generated -// during the compilation. -SHADERC_EXPORT const char* shaderc_result_get_error_message( - const shaderc_compilation_result_t result); - -// Provides the version & revision of the SPIR-V which will be produced -SHADERC_EXPORT void shaderc_get_spv_version(unsigned int* version, unsigned int* revision); - -// Parses the version and profile from a given null-terminated string -// containing both version and profile, like: '450core'. Returns false if -// the string can not be parsed. Returns true when the parsing succeeds. The -// parsed version and profile are returned through arguments. -SHADERC_EXPORT bool shaderc_parse_version_profile(const char* str, int* version, - shaderc_profile* profile); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // SHADERC_SHADERC_H_ diff --git a/lib/shaderc/libshaderc/include/shaderc/shaderc.hpp b/lib/shaderc/libshaderc/include/shaderc/shaderc.hpp deleted file mode 100644 index 13d04b18a..000000000 --- a/lib/shaderc/libshaderc/include/shaderc/shaderc.hpp +++ /dev/null @@ -1,602 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SHADERC_SHADERC_HPP_ -#define SHADERC_SHADERC_HPP_ - -#include -#include -#include - -#include "shaderc.h" - -namespace shaderc { -// A CompilationResult contains the compiler output, compilation status, -// and messages. -// -// The compiler output is stored as an array of elements and accessed -// via random access iterators provided by cbegin() and cend(). The iterators -// are contiguous in the sense of "Contiguous Iterators: A Refinement of -// Random Access Iterators", Nevin Liber, C++ Library Evolution Working -// Group Working Paper N3884. -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3884.pdf -// -// Methods begin() and end() are also provided to enable range-based for. -// They are synonyms to cbegin() and cend(), respectively. -template -class CompilationResult { - public: - typedef OutputElementType element_type; - // The type used to describe the begin and end iterators on the - // compiler output. - typedef const OutputElementType* const_iterator; - - // Upon creation, the CompilationResult takes ownership of the - // shaderc_compilation_result instance. During destruction of the - // CompilationResult, the shaderc_compilation_result will be released. - explicit CompilationResult(shaderc_compilation_result_t compilation_result) - : compilation_result_(compilation_result) {} - CompilationResult() : compilation_result_(nullptr) {} - ~CompilationResult() { shaderc_result_release(compilation_result_); } - - CompilationResult(CompilationResult&& other) : compilation_result_(nullptr) { - *this = std::move(other); - } - - CompilationResult& operator=(CompilationResult&& other) { - if (compilation_result_) { - shaderc_result_release(compilation_result_); - } - compilation_result_ = other.compilation_result_; - other.compilation_result_ = nullptr; - return *this; - } - - // Returns any error message found during compilation. - std::string GetErrorMessage() const { - if (!compilation_result_) { - return ""; - } - return shaderc_result_get_error_message(compilation_result_); - } - - // Returns the compilation status, indicating whether the compilation - // succeeded, or failed due to some reasons, like invalid shader stage or - // compilation errors. - shaderc_compilation_status GetCompilationStatus() const { - if (!compilation_result_) { - return shaderc_compilation_status_null_result_object; - } - return shaderc_result_get_compilation_status(compilation_result_); - } - - // Returns a random access (contiguous) iterator pointing to the start - // of the compilation output. It is valid for the lifetime of this object. - // If there is no compilation result, then returns nullptr. - const_iterator cbegin() const { - if (!compilation_result_) return nullptr; - return reinterpret_cast( - shaderc_result_get_bytes(compilation_result_)); - } - - // Returns a random access (contiguous) iterator pointing to the end of - // the compilation output. It is valid for the lifetime of this object. - // If there is no compilation result, then returns nullptr. - const_iterator cend() const { - if (!compilation_result_) return nullptr; - return cbegin() + - shaderc_result_get_length(compilation_result_) / - sizeof(OutputElementType); - } - - // Returns the same iterator as cbegin(). - const_iterator begin() const { return cbegin(); } - // Returns the same iterator as cend(). - const_iterator end() const { return cend(); } - - // Returns the number of warnings generated during the compilation. - size_t GetNumWarnings() const { - if (!compilation_result_) { - return 0; - } - return shaderc_result_get_num_warnings(compilation_result_); - } - - // Returns the number of errors generated during the compilation. - size_t GetNumErrors() const { - if (!compilation_result_) { - return 0; - } - return shaderc_result_get_num_errors(compilation_result_); - } - - private: - CompilationResult(const CompilationResult& other) = delete; - CompilationResult& operator=(const CompilationResult& other) = delete; - - shaderc_compilation_result_t compilation_result_; -}; - -// A compilation result for a SPIR-V binary module, which is an array -// of uint32_t words. -using SpvCompilationResult = CompilationResult; -// A compilation result in SPIR-V assembly syntax. -using AssemblyCompilationResult = CompilationResult; -// Preprocessed source text. -using PreprocessedSourceCompilationResult = CompilationResult; - -// Contains any options that can have default values for a compilation. -class CompileOptions { - public: - CompileOptions() { options_ = shaderc_compile_options_initialize(); } - ~CompileOptions() { shaderc_compile_options_release(options_); } - CompileOptions(const CompileOptions& other) { - options_ = shaderc_compile_options_clone(other.options_); - } - CompileOptions(CompileOptions&& other) { - options_ = other.options_; - other.options_ = nullptr; - } - - // Adds a predefined macro to the compilation options. It behaves the same as - // shaderc_compile_options_add_macro_definition in shaderc.h. - void AddMacroDefinition(const char* name, size_t name_length, - const char* value, size_t value_length) { - shaderc_compile_options_add_macro_definition(options_, name, name_length, - value, value_length); - } - - // Adds a valueless predefined macro to the compilation options. - void AddMacroDefinition(const std::string& name) { - AddMacroDefinition(name.c_str(), name.size(), nullptr, 0u); - } - - // Adds a predefined macro to the compilation options. - void AddMacroDefinition(const std::string& name, const std::string& value) { - AddMacroDefinition(name.c_str(), name.size(), value.c_str(), value.size()); - } - - // Sets the compiler mode to generate debug information in the output. - void SetGenerateDebugInfo() { - shaderc_compile_options_set_generate_debug_info(options_); - } - - // Sets the compiler optimization level to the given level. Only the last one - // takes effect if multiple calls of this function exist. - void SetOptimizationLevel(shaderc_optimization_level level) { - shaderc_compile_options_set_optimization_level(options_, level); - } - - // A C++ version of the libshaderc includer interface. - class IncluderInterface { - public: - // Handles shaderc_include_resolver_fn callbacks. - virtual shaderc_include_result* GetInclude(const char* requested_source, - shaderc_include_type type, - const char* requesting_source, - size_t include_depth) = 0; - - // Handles shaderc_include_result_release_fn callbacks. - virtual void ReleaseInclude(shaderc_include_result* data) = 0; - - virtual ~IncluderInterface() = default; - }; - - // Sets the includer instance for libshaderc to call during compilation, as - // described in shaderc_compile_options_set_include_callbacks(). Callbacks - // are routed to this includer's methods. - void SetIncluder(std::unique_ptr&& includer) { - includer_ = std::move(includer); - shaderc_compile_options_set_include_callbacks( - options_, - [](void* user_data, const char* requested_source, int type, - const char* requesting_source, size_t include_depth) { - auto* sub_includer = static_cast(user_data); - return sub_includer->GetInclude( - requested_source, static_cast(type), - requesting_source, include_depth); - }, - [](void* user_data, shaderc_include_result* include_result) { - auto* sub_includer = static_cast(user_data); - return sub_includer->ReleaseInclude(include_result); - }, - includer_.get()); - } - - // Forces the GLSL language version and profile to a given pair. The version - // number is the same as would appear in the #version annotation in the - // source. Version and profile specified here overrides the #version - // annotation in the source. Use profile: 'shaderc_profile_none' for GLSL - // versions that do not define profiles, e.g. versions below 150. - void SetForcedVersionProfile(int version, shaderc_profile profile) { - shaderc_compile_options_set_forced_version_profile(options_, version, - profile); - } - - // Sets the compiler mode to suppress warnings. Note this option overrides - // warnings-as-errors mode. When both suppress-warnings and warnings-as-errors - // modes are turned on, warning messages will be inhibited, and will not be - // emitted as error message. - void SetSuppressWarnings() { - shaderc_compile_options_set_suppress_warnings(options_); - } - - // Sets the source language. The default is GLSL. - void SetSourceLanguage(shaderc_source_language lang) { - shaderc_compile_options_set_source_language(options_, lang); - } - - // Sets the target shader environment, affecting which warnings or errors will - // be issued. The version will be for distinguishing between different - // versions of the target environment. The version value should be either 0 - // or a value listed in shaderc_env_version. The 0 value maps to Vulkan 1.0 - // if |target| is Vulkan, and it maps to OpenGL 4.5 if |target| is OpenGL. - void SetTargetEnvironment(shaderc_target_env target, uint32_t version) { - shaderc_compile_options_set_target_env(options_, target, version); - } - - // Sets the target SPIR-V version. The generated module will use this version - // of SPIR-V. Each target environment determines what versions of SPIR-V - // it can consume. Defaults to the highest version of SPIR-V 1.0 which is - // required to be supported by the target environment. E.g. Default to SPIR-V - // 1.0 for Vulkan 1.0 and SPIR-V 1.3 for Vulkan 1.1. - void SetTargetSpirv(shaderc_spirv_version version) { - shaderc_compile_options_set_target_spirv(options_, version); - } - - // Sets the compiler mode to make all warnings into errors. Note the - // suppress-warnings mode overrides this option, i.e. if both - // warning-as-errors and suppress-warnings modes are set on, warnings will not - // be emitted as error message. - void SetWarningsAsErrors() { - shaderc_compile_options_set_warnings_as_errors(options_); - } - - // Sets a resource limit. - void SetLimit(shaderc_limit limit, int value) { - shaderc_compile_options_set_limit(options_, limit, value); - } - - // Sets whether the compiler should automatically assign bindings to uniforms - // that aren't already explicitly bound in the shader source. - void SetAutoBindUniforms(bool auto_bind) { - shaderc_compile_options_set_auto_bind_uniforms(options_, auto_bind); - } - - // Sets whether the compiler should automatically remove sampler variables - // and convert image variables to combined image sampler variables. - void SetAutoSampledTextures(bool auto_sampled) { - shaderc_compile_options_set_auto_combined_image_sampler(options_, - auto_sampled); - } - - // Sets whether the compiler should use HLSL IO mapping rules for bindings. - // Defaults to false. - void SetHlslIoMapping(bool hlsl_iomap) { - shaderc_compile_options_set_hlsl_io_mapping(options_, hlsl_iomap); - } - - // Sets whether the compiler should determine block member offsets using HLSL - // packing rules instead of standard GLSL rules. Defaults to false. Only - // affects GLSL compilation. HLSL rules are always used when compiling HLSL. - void SetHlslOffsets(bool hlsl_offsets) { - shaderc_compile_options_set_hlsl_offsets(options_, hlsl_offsets); - } - - // Sets the base binding number used for for a uniform resource type when - // automatically assigning bindings. For GLSL compilation, sets the lowest - // automatically assigned number. For HLSL compilation, the regsiter number - // assigned to the resource is added to this specified base. - void SetBindingBase(shaderc_uniform_kind kind, uint32_t base) { - shaderc_compile_options_set_binding_base(options_, kind, base); - } - - // Like SetBindingBase, but only takes effect when compiling a given shader - // stage. The stage is assumed to be one of vertex, fragment, tessellation - // evaluation, tesselation control, geometry, or compute. - void SetBindingBaseForStage(shaderc_shader_kind shader_kind, - shaderc_uniform_kind kind, uint32_t base) { - shaderc_compile_options_set_binding_base_for_stage(options_, shader_kind, - kind, base); - } - - // Sets whether the compiler automatically assigns locations to - // uniform variables that don't have explicit locations. - void SetAutoMapLocations(bool auto_map) { - shaderc_compile_options_set_auto_map_locations(options_, auto_map); - } - - // Sets a descriptor set and binding for an HLSL register in the given stage. - // Copies the parameter strings. - void SetHlslRegisterSetAndBindingForStage(shaderc_shader_kind shader_kind, - const std::string& reg, - const std::string& set, - const std::string& binding) { - shaderc_compile_options_set_hlsl_register_set_and_binding_for_stage( - options_, shader_kind, reg.c_str(), set.c_str(), binding.c_str()); - } - - // Sets a descriptor set and binding for an HLSL register in any stage. - // Copies the parameter strings. - void SetHlslRegisterSetAndBinding(const std::string& reg, - const std::string& set, - const std::string& binding) { - shaderc_compile_options_set_hlsl_register_set_and_binding( - options_, reg.c_str(), set.c_str(), binding.c_str()); - } - - // Sets whether the compiler should enable extension - // SPV_GOOGLE_hlsl_functionality1. - void SetHlslFunctionality1(bool enable) { - shaderc_compile_options_set_hlsl_functionality1(options_, enable); - } - - // Sets whether the compiler should invert position.Y output in vertex shader. - void SetInvertY(bool enable) { - shaderc_compile_options_set_invert_y(options_, enable); - } - - // Sets whether the compiler should generates code for max an min which, - // if given a NaN operand, will return the other operand. Similarly, the - // clamp builtin will favour the non-NaN operands, as if clamp were - // implemented as a composition of max and min. - void SetNanClamp(bool enable) { - shaderc_compile_options_set_nan_clamp(options_, enable); - } - - private: - CompileOptions& operator=(const CompileOptions& other) = delete; - shaderc_compile_options_t options_; - std::unique_ptr includer_; - - friend class Compiler; -}; - -// The compilation context for compiling source to SPIR-V. -class Compiler { - public: - Compiler() : compiler_(shaderc_compiler_initialize()) {} - ~Compiler() { shaderc_compiler_release(compiler_); } - - Compiler(Compiler&& other) { - compiler_ = other.compiler_; - other.compiler_ = nullptr; - } - - bool IsValid() const { return compiler_ != nullptr; } - - // Compiles the given source GLSL and returns a SPIR-V binary module - // compilation result. - // The source_text parameter must be a valid pointer. - // The source_text_size parameter must be the length of the source text. - // The shader_kind parameter either forces the compilation to be done with a - // specified shader kind, or hint the compiler how to determine the exact - // shader kind. If the shader kind is set to shaderc_glslc_infer_from_source, - // the compiler will try to deduce the shader kind from the source string and - // a failure in this proess will generate an error. Currently only #pragma - // annotation is supported. If the shader kind is set to one of the default - // shader kinds, the compiler will fall back to the specified default shader - // kind in case it failed to deduce the shader kind from the source string. - // The input_file_name is a null-termintated string. It is used as a tag to - // identify the source string in cases like emitting error messages. It - // doesn't have to be a 'file name'. - // The entry_point_name parameter is a null-terminated string specifying - // the entry point name for HLSL compilation. For GLSL compilation, the - // entry point name is assumed to be "main". - // The compilation is passed any options specified in the CompileOptions - // parameter. - // It is valid for the returned CompilationResult object to outlive this - // compiler object. - // Note when the options_ has disassembly mode or preprocessing only mode set - // on, the returned CompilationResult will hold a text string, instead of a - // SPIR-V binary generated with default options. - SpvCompilationResult CompileGlslToSpv(const char* source_text, - size_t source_text_size, - shaderc_shader_kind shader_kind, - const char* input_file_name, - const char* entry_point_name, - const CompileOptions& options) const { - shaderc_compilation_result_t compilation_result = shaderc_compile_into_spv( - compiler_, source_text, source_text_size, shader_kind, input_file_name, - entry_point_name, options.options_); - return SpvCompilationResult(compilation_result); - } - - // Compiles the given source shader and returns a SPIR-V binary module - // compilation result. - // Like the first CompileGlslToSpv method but assumes the entry point name - // is "main". - SpvCompilationResult CompileGlslToSpv(const char* source_text, - size_t source_text_size, - shaderc_shader_kind shader_kind, - const char* input_file_name, - const CompileOptions& options) const { - return CompileGlslToSpv(source_text, source_text_size, shader_kind, - input_file_name, "main", options); - } - - // Compiles the given source GLSL and returns a SPIR-V binary module - // compilation result. - // Like the previous CompileGlslToSpv method but uses default options. - SpvCompilationResult CompileGlslToSpv(const char* source_text, - size_t source_text_size, - shaderc_shader_kind shader_kind, - const char* input_file_name) const { - shaderc_compilation_result_t compilation_result = - shaderc_compile_into_spv(compiler_, source_text, source_text_size, - shader_kind, input_file_name, "main", nullptr); - return SpvCompilationResult(compilation_result); - } - - // Compiles the given source shader and returns a SPIR-V binary module - // compilation result. - // Like the first CompileGlslToSpv method but the source is provided as - // a std::string, and we assume the entry point is "main". - SpvCompilationResult CompileGlslToSpv(const std::string& source_text, - shaderc_shader_kind shader_kind, - const char* input_file_name, - const CompileOptions& options) const { - return CompileGlslToSpv(source_text.data(), source_text.size(), shader_kind, - input_file_name, options); - } - - // Compiles the given source shader and returns a SPIR-V binary module - // compilation result. - // Like the first CompileGlslToSpv method but the source is provided as - // a std::string. - SpvCompilationResult CompileGlslToSpv(const std::string& source_text, - shaderc_shader_kind shader_kind, - const char* input_file_name, - const char* entry_point_name, - const CompileOptions& options) const { - return CompileGlslToSpv(source_text.data(), source_text.size(), shader_kind, - input_file_name, entry_point_name, options); - } - - // Compiles the given source GLSL and returns a SPIR-V binary module - // compilation result. - // Like the previous CompileGlslToSpv method but assumes the entry point - // name is "main". - SpvCompilationResult CompileGlslToSpv(const std::string& source_text, - shaderc_shader_kind shader_kind, - const char* input_file_name) const { - return CompileGlslToSpv(source_text.data(), source_text.size(), shader_kind, - input_file_name); - } - - // Assembles the given SPIR-V assembly and returns a SPIR-V binary module - // compilation result. - // The assembly should follow the syntax defined in the SPIRV-Tools project - // (https://github.com/KhronosGroup/SPIRV-Tools/blob/master/syntax.md). - // It is valid for the returned CompilationResult object to outlive this - // compiler object. - // The assembling will pick options suitable for assembling specified in the - // CompileOptions parameter. - SpvCompilationResult AssembleToSpv(const char* source_assembly, - size_t source_assembly_size, - const CompileOptions& options) const { - return SpvCompilationResult(shaderc_assemble_into_spv( - compiler_, source_assembly, source_assembly_size, options.options_)); - } - - // Assembles the given SPIR-V assembly and returns a SPIR-V binary module - // compilation result. - // Like the first AssembleToSpv method but uses the default compiler options. - SpvCompilationResult AssembleToSpv(const char* source_assembly, - size_t source_assembly_size) const { - return SpvCompilationResult(shaderc_assemble_into_spv( - compiler_, source_assembly, source_assembly_size, nullptr)); - } - - // Assembles the given SPIR-V assembly and returns a SPIR-V binary module - // compilation result. - // Like the first AssembleToSpv method but the source is provided as a - // std::string. - SpvCompilationResult AssembleToSpv(const std::string& source_assembly, - const CompileOptions& options) const { - return SpvCompilationResult( - shaderc_assemble_into_spv(compiler_, source_assembly.data(), - source_assembly.size(), options.options_)); - } - - // Assembles the given SPIR-V assembly and returns a SPIR-V binary module - // compilation result. - // Like the first AssembleToSpv method but the source is provided as a - // std::string and also uses default compiler options. - SpvCompilationResult AssembleToSpv(const std::string& source_assembly) const { - return SpvCompilationResult(shaderc_assemble_into_spv( - compiler_, source_assembly.data(), source_assembly.size(), nullptr)); - } - - // Compiles the given source GLSL and returns the SPIR-V assembly text - // compilation result. - // Options are similar to the first CompileToSpv method. - AssemblyCompilationResult CompileGlslToSpvAssembly( - const char* source_text, size_t source_text_size, - shaderc_shader_kind shader_kind, const char* input_file_name, - const char* entry_point_name, const CompileOptions& options) const { - shaderc_compilation_result_t compilation_result = - shaderc_compile_into_spv_assembly( - compiler_, source_text, source_text_size, shader_kind, - input_file_name, entry_point_name, options.options_); - return AssemblyCompilationResult(compilation_result); - } - - // Compiles the given source GLSL and returns the SPIR-V assembly text - // compilation result. - // Similare to the previous method, but assumes entry point name is "main". - AssemblyCompilationResult CompileGlslToSpvAssembly( - const char* source_text, size_t source_text_size, - shaderc_shader_kind shader_kind, const char* input_file_name, - const CompileOptions& options) const { - return CompileGlslToSpvAssembly(source_text, source_text_size, shader_kind, - input_file_name, "main", options); - } - - // Compiles the given source GLSL and returns the SPIR-V assembly text - // result. Like the first CompileGlslToSpvAssembly method but the source - // is provided as a std::string. Options are otherwise similar to - // the first CompileToSpv method. - AssemblyCompilationResult CompileGlslToSpvAssembly( - const std::string& source_text, shaderc_shader_kind shader_kind, - const char* input_file_name, const char* entry_point_name, - const CompileOptions& options) const { - return CompileGlslToSpvAssembly(source_text.data(), source_text.size(), - shader_kind, input_file_name, - entry_point_name, options); - } - - // Compiles the given source GLSL and returns the SPIR-V assembly text - // result. Like the previous CompileGlslToSpvAssembly method but assumes - // the entry point name is "main". - AssemblyCompilationResult CompileGlslToSpvAssembly( - const std::string& source_text, shaderc_shader_kind shader_kind, - const char* input_file_name, const CompileOptions& options) const { - return CompileGlslToSpvAssembly(source_text, shader_kind, input_file_name, - "main", options); - } - - // Preprocesses the given source GLSL and returns the preprocessed - // source text as a compilation result. - // Options are similar to the first CompileToSpv method. - PreprocessedSourceCompilationResult PreprocessGlsl( - const char* source_text, size_t source_text_size, - shaderc_shader_kind shader_kind, const char* input_file_name, - const CompileOptions& options) const { - shaderc_compilation_result_t compilation_result = - shaderc_compile_into_preprocessed_text( - compiler_, source_text, source_text_size, shader_kind, - input_file_name, "main", options.options_); - return PreprocessedSourceCompilationResult(compilation_result); - } - - // Preprocesses the given source GLSL and returns text result. Like the first - // PreprocessGlsl method but the source is provided as a std::string. - // Options are otherwise similar to the first CompileToSpv method. - PreprocessedSourceCompilationResult PreprocessGlsl( - const std::string& source_text, shaderc_shader_kind shader_kind, - const char* input_file_name, const CompileOptions& options) const { - return PreprocessGlsl(source_text.data(), source_text.size(), shader_kind, - input_file_name, options); - } - - private: - Compiler(const Compiler&) = delete; - Compiler& operator=(const Compiler& other) = delete; - - shaderc_compiler_t compiler_; -}; -} // namespace shaderc - -#endif // SHADERC_SHADERC_HPP_ diff --git a/lib/shaderc/libshaderc/include/shaderc/status.h b/lib/shaderc/libshaderc/include/shaderc/status.h deleted file mode 100644 index 57ac70d7e..000000000 --- a/lib/shaderc/libshaderc/include/shaderc/status.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2018 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SHADERC_STATUS_H_ -#define SHADERC_STATUS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -// Indicate the status of a compilation. -typedef enum { - shaderc_compilation_status_success = 0, - shaderc_compilation_status_invalid_stage = 1, // error stage deduction - shaderc_compilation_status_compilation_error = 2, - shaderc_compilation_status_internal_error = 3, // unexpected failure - shaderc_compilation_status_null_result_object = 4, - shaderc_compilation_status_invalid_assembly = 5, - shaderc_compilation_status_validation_error = 6, - shaderc_compilation_status_transformation_error = 7, - shaderc_compilation_status_configuration_error = 8, -} shaderc_compilation_status; - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // SHADERC_STATUS_H_ diff --git a/lib/shaderc/libshaderc/include/shaderc/visibility.h b/lib/shaderc/libshaderc/include/shaderc/visibility.h deleted file mode 100644 index 88ec151bf..000000000 --- a/lib/shaderc/libshaderc/include/shaderc/visibility.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SHADERC_VISIBILITY_H_ -#define SHADERC_VISIBILITY_H_ - -// SHADERC_EXPORT tags symbol that will be exposed by the shared libraries. -#if defined(SHADERC_SHAREDLIB) -#if defined(_WIN32) -#if defined(SHADERC_IMPLEMENTATION) -#define SHADERC_EXPORT __declspec(dllexport) -#else -#define SHADERC_EXPORT __declspec(dllimport) -#endif -#else -#if defined(SHADERC_IMPLEMENTATION) -#define SHADERC_EXPORT __attribute__((visibility("default"))) -#else -#define SHADERC_EXPORT -#endif -#endif -#else -#define SHADERC_EXPORT -#endif - -#endif // SHADERC_VISIBILITY_H_ diff --git a/lib/shaderc/libshaderc/src/common_shaders_for_test.h b/lib/shaderc/libshaderc/src/common_shaders_for_test.h deleted file mode 100644 index e177797ac..000000000 --- a/lib/shaderc/libshaderc/src/common_shaders_for_test.h +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef COMMON_SHADERS_FOR_TESTS_H_ -#define COMMON_SHADERS_FOR_TESTS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -// The minimal shader, without a version directive. -const char kMinimalShaderWithoutVersion[] = "void main(){}"; -// The minimal shader, with a version directive. -const char kMinimalShader[] = - "#version 140\n" - "void main(){}"; -const char kMinimalHlslShader[] = - "float4 EntryPoint(uint index : SV_VERTEXID) : SV_POSITION\n" - "{ return float4(1.0, 2.0, 3.0, 4.0); }"; -const char kMinimalShaderWithMacro[] = - "#version 140\n" - "#define E main\n" - "void E(){}\n"; - -// The minimal shader that needs valueless predefinition of 'E' to compile. -const char kValuelessPredefinitionShader[] = - "#version 140\n" - "#ifdef E\n" - "void main(){}\n" - "#else\n" - "#error\n" - "#endif"; - -// By default the compiler will emit a warning on line 2 complaining -// that 'float' is a deprecated attribute in version 130. Use verison 140 -// because some versions of glslang will error out for a too-low version -// when generating SPIR-V. -const char kDeprecatedAttributeShader[] = - "#version 400\n" - "layout(location = 0) attribute float x;\n" - "void main() {}\n"; - -// By default the compiler will emit a warning as version 550 is an unknown -// version. -const char kMinimalUnknownVersionShader[] = - "#version 550\n" - "void main() {}\n"; - -// gl_ClipDistance doesn't exist in es profile (at least until 3.10). -const char kCoreVertShaderWithoutVersion[] = - "void main() {\n" - "gl_ClipDistance[0] = 5.;\n" - "}\n"; - -// Generated debug information should contain the name of the vector: -// debug_info_sample. -const char kMinimalDebugInfoShader[] = - "#version 140\n" - "void main(){\n" - "vec2 debug_info_sample = vec2(1.0,1.0);\n" - "}\n"; - -// Compiler should generate two errors. -const char kTwoErrorsShader[] = - "#version 150\n" - "#error\n" - "#error\n" - "void main(){}\n"; - -// Compiler should generate two warnings. -const char kTwoWarningsShader[] = - "#version 400\n" - "layout(location = 0) attribute float x;\n" - "layout(location = 1) attribute float y;\n" - "void main(){}\n"; - -// A shader that compiles under OpenGL compatibility profile rules, -// but not OpenGL core profile rules. -const char kOpenGLCompatibilityFragmentShader[] = - R"(#version 100 - uniform highp sampler2D tex; - void main() { - gl_FragColor = texture2D(tex, vec2(0.0,0.0)); - })"; - -// A shader that compiles under OpenGL core profile rules. -const char kOpenGLVertexShader[] = - R"(#version 330 - void main() { int t = gl_VertexID; })"; - -// Empty 310 es shader. It is valid for vertex, fragment, compute shader kind. -const char kEmpty310ESShader[] = - "#version 310 es\n" - "void main() {}\n"; - -// Vertex only shader. -const char kVertexOnlyShader[] = - "#version 310 es\n" - "void main() {\n" - " gl_Position = vec4(1.);\n" - "}"; - -// TessControl only shader. -const char kTessControlOnlyShader[] = - "#version 440 core\n" - "layout(vertices = 3) out;\n" - "void main() { }"; - -// TessEvaluation only shader. -const char kTessEvaluationOnlyShader[] = - "#version 440 core\n" - "layout(triangles) in;\n" - "void main() { }"; - -// Geometry only shader. -const char kGeometryOnlyShader[] = - "#version 150 core\n" - "layout (triangles) in;\n" - "layout (line_strip, max_vertices = 4) out;\n" - "void main() { }"; - -// Vertex only shader with #pragma annotation. -const char kVertexOnlyShaderWithPragma[] = - "#version 310 es\n" - "#pragma shader_stage(vertex)\n" - "void main() {\n" - " gl_Position = vec4(1.);\n" - "}"; - -// Fragment only shader with #pragma annotation. -const char kFragmentOnlyShaderWithPragma[] = - "#version 310 es\n" - "#pragma shader_stage(fragment)\n" - "void main() {\n" - " gl_FragDepth = 10.;\n" - "}"; - -// TessControl only shader with #pragma annotation. -const char kTessControlOnlyShaderWithPragma[] = - "#version 440 core\n" - "#pragma shader_stage(tesscontrol)\n" - "layout(vertices = 3) out;\n" - "void main() { }"; - -// TessEvaluation only shader with #pragma annotation. -const char kTessEvaluationOnlyShaderWithPragma[] = - "#version 440 core\n" - "#pragma shader_stage(tesseval)\n" - "layout(triangles) in;\n" - "void main() { }"; - -// Geometry only shader with #pragma annotation. -const char kGeometryOnlyShaderWithPragma[] = - "#version 150 core\n" - "#pragma shader_stage(geometry)\n" - "layout (triangles) in;\n" - "layout (line_strip, max_vertices = 4) out;\n" - "void main() { }"; - -// Compute only shader with #pragma annotation. -const char kComputeOnlyShaderWithPragma[] = - "#version 310 es\n" - "#pragma shader_stage(compute)\n" - "void main() {\n" - " uvec3 temp = gl_WorkGroupID;\n" - "}"; - -// NV mesh shader without #pragma. -const char kNVMeshShader[] = - "#version 450\n" - "#extension GL_NV_mesh_shader : enable\n" - "layout(local_size_x=8) in;\n" - "layout(max_vertices=5) out;\n" - "layout(max_primitives=10) out;\n" - "layout(triangles) out;\n" - "void main() {\n" - " gl_MeshVerticesNV[gl_LocalInvocationID.x].gl_Position = vec4(0.0);\n" - "}\n"; - -// NV mesh shader with #pragma annotation. -const char kNVMeshShaderWithPragma[] = - "#version 450\n" - "#extension GL_NV_mesh_shader : enable\n" - "#pragma shader_stage(mesh)\n" - "layout(local_size_x=8) in;\n" - "layout(max_vertices=5) out;\n" - "layout(max_primitives=10) out;\n" - "layout(triangles) out;\n" - "void main() {\n" - " gl_MeshVerticesNV[gl_LocalInvocationID.x].gl_Position = vec4(0.0);\n" - "}\n"; - -// NV task shader without #pragma annotation. -const char kNVTaskShader[] = - "#version 450\n" - "#extension GL_NV_mesh_shader : enable\n" - "layout(local_size_x=8) in;\n" - "void main() {\n" - " gl_TaskCountNV = 2;\n" - "}\n"; - -// NV task shader with #pragma annotation. -const char kNVTaskShaderWithPragma[] = - "#version 450\n" - "#extension GL_NV_mesh_shader : enable\n" - "#pragma shader_stage(task)\n" - "layout(local_size_x=8) in;\n" - "void main() {\n" - " gl_TaskCountNV = 2;\n" - "}\n"; - -// Vertex only shader with invalid #pragma annotation. -const char kVertexOnlyShaderWithInvalidPragma[] = - "#version 310 es\n" - "#pragma shader_stage(fragment)\n" - "void main() {\n" - " gl_Position = vec4(1.);\n" - "}"; - -// Parts of a valid disassembly of a minimal shader. We only check certain -// parts since Glslang code generation changes in incidental ways. -const char* kMinimalShaderDisassemblySubstrings[] = { - "; SPIR-V\n" - "; Version: 1.0\n" - "; Generator: Google Shaderc over Glslang; 10\n" - "; Bound:", - - " OpCapability Shader\n", - " %1 = OpExtInstImport \"GLSL.std.450\"\n", - " OpMemoryModel Logical GLSL450\n", - " OpReturn\n", - " OpFunctionEnd\n"}; - -const char* kMinimalShaderDebugInfoDisassemblySubstrings[] = { - "; SPIR-V\n" - "; Version: 1.0\n" - "; Generator: Google Shaderc over Glslang; 10\n" - "; Bound:", - - " OpCapability Shader\n", - " %2 = OpExtInstImport \"GLSL.std.450\"\n", - " OpMemoryModel Logical GLSL450\n", - " OpReturn\n", - " OpFunctionEnd\n"}; - -const char kMinimalShaderAssembly[] = R"( - ; SPIR-V - ; Version: 1.0 - ; Generator: Google Shaderc over Glslang; 10 - ; Bound: 6 - ; Schema: 0 - - OpCapability Shader - %1 = OpExtInstImport "GLSL.std.450" - OpMemoryModel Logical GLSL450 - OpEntryPoint Vertex %4 "main" - OpSource ESSL 310 - OpName %4 "main" - %2 = OpTypeVoid - %3 = OpTypeFunction %2 - %4 = OpFunction %2 None %3 - %5 = OpLabel - OpReturn - OpFunctionEnd)"; - -const char kShaderWithUniformsWithoutBindings[] = - R"(#version 450 - #extension GL_ARB_sparse_texture2 : enable - uniform texture2D my_tex; - uniform sampler my_sam; - layout(rgba32f) uniform image2D my_img; - layout(rgba32f) uniform imageBuffer my_imbuf; - uniform block { float x; float y; } my_ubo; - void main() { - texture(sampler2D(my_tex,my_sam),vec2(1.0)); - vec4 t; - sparseImageLoadARB(my_img,ivec2(0),t); - imageLoad(my_imbuf,42); - float x = my_ubo.x; - })"; - -// A GLSL vertex shader with a weirdly packed block. -const char kGlslShaderWeirdPacking[] = - R"(#version 450 - layout(set=0, binding=0) - buffer B { float x; vec3 foo; } my_ssbo; - void main() { my_ssbo.x = 1.0; })"; - -// A HLSL fragment shader with a weirdly packed block. -const char kHlslFragShaderWithRegisters[] = - R"(Buffer t4 : register(t4); - Buffer t5 : register(t5); - float4 main() : SV_Target0 { - return float4(t4.Load(0) + t5.Load(1)); - })"; - -// A GLSL compute shader using a regular barrier. -const char kGlslShaderComputeBarrier[] = - R"(#version 450 - void main() { barrier(); })"; - -// A GLSL compute shader using the Subgroups feature. -const char kGlslShaderComputeSubgroupBarrier[] = - R"(#version 450 - #extension GL_KHR_shader_subgroup_basic : enable - void main() { subgroupBarrier(); })"; - -// A GLSL task shader using a regular barrier. -const char kGlslShaderTaskBarrier[] = - R"(#version 450 - #extension GL_NV_mesh_shader : enable - layout(local_size_x = 32) in; - void main() { barrier(); })"; - -// A GLSL task shader using the Subgroups feature. -const char kGlslShaderTaskSubgroupBarrier[] = - R"(#version 450 - #extension GL_NV_mesh_shader : enable - #extension GL_KHR_shader_subgroup_basic : enable - layout(local_size_x = 32) in; - void main() { subgroupBarrier(); })"; - -// A GLSL mesh shader using a regular barrier. -const char kGlslShaderMeshBarrier[] = - R"(#version 450 - #extension GL_NV_mesh_shader : enable - layout(local_size_x = 32) in; - layout(max_vertices=81) out; - layout(max_primitives=32) out; - layout(triangles) out; - void main() { barrier(); })"; - -// A GLSL mesh shader using the Subgroups feature. -const char kGlslShaderMeshSubgroupBarrier[] = - R"(#version 450 - #extension GL_NV_mesh_shader : enable - #extension GL_KHR_shader_subgroup_basic : enable - layout(local_size_x = 32) in; - layout(max_vertices=81) out; - layout(max_primitives=32) out; - layout(triangles) out; - void main() { subgroupBarrier(); })"; - -const char kGlslMultipleFnShader[] = - R"(#version 450 - layout(location=0) flat in int inVal; - layout(location=0) out int outVal; - int foo(int a) { return a; } - void main() { outVal = foo(inVal); })"; - -const char kHlslShaderWithCounterBuffer[] = - R"(RWStructuredBuffer Ainc; - float4 main() : SV_Target0 { - return float4(Ainc.IncrementCounter(), 0, 0, 0); - })"; - -const char kHlslWaveActiveSumeComputeShader[] = - R"(struct S { uint val; uint result; }; - - [[vk::binding(0,0)]] - RWStructuredBuffer MyBuffer; - - [numthreads(32, 1, 1)] - void main(uint3 id : SV_DispatchThreadID) { - MyBuffer[id.x].result = WaveActiveSum(MyBuffer[id.x].val); - })"; - -const char kHlslMemLayoutResourceSelect[] = - R"(cbuffer Foo { float a; float3 b; } - - [[vk::binding(0,0)]] - Texture2D Tex; - [[vk::binding(1,0)]] - SamplerState Sampler1; - [[vk::binding(2,0)]] - SamplerState Sampler2; - - static const int val = 42; - - float4 main() : SV_Target { - SamplerState samp; - - if (val > 5) - samp = Sampler1; - else - samp = Sampler2; - - return Tex.Sample(samp, float2(0.5, 0.5)) + float4(a, b); - })"; - -const char kGlslShaderWithClamp[] = - R"(#version 450 - layout(location=0) in vec4 i; - layout(location=0) out vec4 o; - void main() { o = clamp(i, vec4(0.5), vec4(1.0)); } - )"; - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // COMMON_SHADERS_FOR_TESTS_H_ diff --git a/lib/shaderc/libshaderc/src/shaderc.cc b/lib/shaderc/libshaderc/src/shaderc.cc deleted file mode 100644 index 712f3dc30..000000000 --- a/lib/shaderc/libshaderc/src/shaderc.cc +++ /dev/null @@ -1,794 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include -#include -#include - -#include "libshaderc_util/compiler.h" -#include "libshaderc_util/counting_includer.h" -#include "libshaderc_util/resources.h" -#include "libshaderc_util/spirv_tools_wrapper.h" -#include "libshaderc_util/version_profile.h" -#include "shaderc_private.h" -#include "spirv/unified1/spirv.hpp" - -#if (defined(_MSC_VER) && !defined(_CPPUNWIND)) || !defined(__EXCEPTIONS) -#define TRY_IF_EXCEPTIONS_ENABLED -#define CATCH_IF_EXCEPTIONS_ENABLED(X) if (0) -#else -#define TRY_IF_EXCEPTIONS_ENABLED try -#define CATCH_IF_EXCEPTIONS_ENABLED(X) catch (X) -#endif - -namespace { - -// Returns shader stage (ie: vertex, fragment, etc.) in response to forced -// shader kinds. If the shader kind is not a forced kind, returns EshLangCount -// to let #pragma annotation or shader stage deducer determine the stage to -// use. -EShLanguage GetForcedStage(shaderc_shader_kind kind) { - switch (kind) { - case shaderc_glsl_vertex_shader: - return EShLangVertex; - case shaderc_glsl_fragment_shader: - return EShLangFragment; - case shaderc_glsl_compute_shader: - return EShLangCompute; - case shaderc_glsl_geometry_shader: - return EShLangGeometry; - case shaderc_glsl_tess_control_shader: - return EShLangTessControl; - case shaderc_glsl_tess_evaluation_shader: - return EShLangTessEvaluation; - - case shaderc_glsl_raygen_shader: - return EShLangRayGenNV; - case shaderc_glsl_anyhit_shader: - return EShLangAnyHitNV; - case shaderc_glsl_closesthit_shader: - return EShLangClosestHitNV; - case shaderc_glsl_miss_shader: - return EShLangMissNV; - case shaderc_glsl_intersection_shader: - return EShLangIntersectNV; - case shaderc_glsl_callable_shader: - return EShLangCallableNV; - case shaderc_glsl_task_shader: - return EShLangTaskNV; - case shaderc_glsl_mesh_shader: - return EShLangMeshNV; - - case shaderc_glsl_infer_from_source: - case shaderc_glsl_default_vertex_shader: - case shaderc_glsl_default_fragment_shader: - case shaderc_glsl_default_compute_shader: - case shaderc_glsl_default_geometry_shader: - case shaderc_glsl_default_tess_control_shader: - case shaderc_glsl_default_tess_evaluation_shader: - case shaderc_glsl_default_raygen_shader: - case shaderc_glsl_default_anyhit_shader: - case shaderc_glsl_default_closesthit_shader: - case shaderc_glsl_default_miss_shader: - case shaderc_glsl_default_intersection_shader: - case shaderc_glsl_default_callable_shader: - case shaderc_glsl_default_task_shader: - case shaderc_glsl_default_mesh_shader: - case shaderc_spirv_assembly: - return EShLangCount; - } - assert(0 && "Unhandled shaderc_shader_kind"); - return EShLangCount; -} - -// A wrapper functor class to be used as stage deducer for libshaderc_util -// Compile() interface. When the given shader kind is one of the default shader -// kinds, this functor will be called if #pragma is not found in the source -// code. And it returns the corresponding shader stage. When the shader kind is -// a forced shader kind, this functor won't be called and it simply returns -// EShLangCount to make the syntax correct. When the shader kind is set to -// shaderc_glsl_deduce_from_pragma, this functor also returns EShLangCount, but -// the compiler should emit error if #pragma annotation is not found in this -// case. -class StageDeducer { - public: - explicit StageDeducer( - shaderc_shader_kind kind = shaderc_glsl_infer_from_source) - : kind_(kind), error_(false){} - // The method that underlying glslang will call to determine the shader stage - // to be used in current compilation. It is called only when there is neither - // forced shader kind (or say stage, in the view of glslang), nor #pragma - // annotation in the source code. This method transforms an user defined - // 'default' shader kind to the corresponding shader stage. As this is the - // last trial to determine the shader stage, failing to find the corresponding - // shader stage will record an error. - // Note that calling this method more than once during one compilation will - // have the error recorded for the previous call been overwriten by the next - // call. - EShLanguage operator()(std::ostream* /*error_stream*/, - const shaderc_util::string_piece& /*error_tag*/) { - EShLanguage stage = GetDefaultStage(kind_); - if (stage == EShLangCount) { - error_ = true; - } else { - error_ = false; - } - return stage; - } - - // Returns true if there is error during shader stage deduction. - bool error() const { return error_; } - - private: - // Gets the corresponding shader stage for a given 'default' shader kind. All - // other kinds are mapped to EShLangCount which should not be used. - EShLanguage GetDefaultStage(shaderc_shader_kind kind) const { - switch (kind) { - case shaderc_glsl_vertex_shader: - case shaderc_glsl_fragment_shader: - case shaderc_glsl_compute_shader: - case shaderc_glsl_geometry_shader: - case shaderc_glsl_tess_control_shader: - case shaderc_glsl_tess_evaluation_shader: - case shaderc_glsl_infer_from_source: - case shaderc_glsl_raygen_shader: - case shaderc_glsl_anyhit_shader: - case shaderc_glsl_closesthit_shader: - case shaderc_glsl_miss_shader: - case shaderc_glsl_intersection_shader: - case shaderc_glsl_callable_shader: - case shaderc_glsl_task_shader: - case shaderc_glsl_mesh_shader: - return EShLangCount; - case shaderc_glsl_default_vertex_shader: - return EShLangVertex; - case shaderc_glsl_default_fragment_shader: - return EShLangFragment; - case shaderc_glsl_default_compute_shader: - return EShLangCompute; - case shaderc_glsl_default_geometry_shader: - return EShLangGeometry; - case shaderc_glsl_default_tess_control_shader: - return EShLangTessControl; - case shaderc_glsl_default_tess_evaluation_shader: - return EShLangTessEvaluation; - case shaderc_glsl_default_raygen_shader: - return EShLangRayGenNV; - case shaderc_glsl_default_anyhit_shader: - return EShLangAnyHitNV; - case shaderc_glsl_default_closesthit_shader: - return EShLangClosestHitNV; - case shaderc_glsl_default_miss_shader: - return EShLangMissNV; - case shaderc_glsl_default_intersection_shader: - return EShLangIntersectNV; - case shaderc_glsl_default_callable_shader: - return EShLangCallableNV; - case shaderc_glsl_default_task_shader: - return EShLangTaskNV; - case shaderc_glsl_default_mesh_shader: - return EShLangMeshNV; - case shaderc_spirv_assembly: - return EShLangCount; - } - assert(0 && "Unhandled shaderc_shader_kind"); - return EShLangCount; - } - - shaderc_shader_kind kind_; - bool error_; -}; - -// A bridge between the libshaderc includer and libshaderc_util includer. -class InternalFileIncluder : public shaderc_util::CountingIncluder { - public: - InternalFileIncluder(const shaderc_include_resolve_fn resolver, - const shaderc_include_result_release_fn result_releaser, - void* user_data) - : resolver_(resolver), - result_releaser_(result_releaser), - user_data_(user_data){} - InternalFileIncluder() - : resolver_(nullptr), result_releaser_(nullptr), user_data_(nullptr){} - - private: - // Check the validity of the callbacks. - bool AreValidCallbacks() const { - return resolver_ != nullptr && result_releaser_ != nullptr; - } - - // Maps CountingIncluder IncludeType value to a shaderc_include_type - // value. - shaderc_include_type GetIncludeType(IncludeType type) { - switch (type) { - case IncludeType::Local: - return shaderc_include_type_relative; - case IncludeType::System: - return shaderc_include_type_standard; - default: - break; - } - assert(0 && "Unhandled IncludeType"); - return shaderc_include_type_relative; - } - - // Resolves an include request for the requested source of the given - // type in the context of the specified requesting source. On success, - // returns a newly allocated IncludeResponse containing the fully resolved - // name of the requested source and the contents of that source. - // On failure, returns a newly allocated IncludeResponse where the - // resolved name member is an empty string, and the contents members - // contains error details. - virtual glslang::TShader::Includer::IncludeResult* include_delegate( - const char* requested_source, const char* requesting_source, - IncludeType type, size_t include_depth) override { - if (!AreValidCallbacks()) { - static const char kUnexpectedIncludeError[] = - "#error unexpected include directive"; - return new glslang::TShader::Includer::IncludeResult{ - "", kUnexpectedIncludeError, strlen(kUnexpectedIncludeError), - nullptr}; - } - shaderc_include_result* include_result = - resolver_(user_data_, requested_source, GetIncludeType(type), - requesting_source, include_depth); - // Make a glslang IncludeResult from a shaderc_include_result. The - // user_data member of the IncludeResult is a pointer to the - // shaderc_include_result object, so we can later release the latter. - return new glslang::TShader::Includer::IncludeResult{ - std::string(include_result->source_name, - include_result->source_name_length), - include_result->content, include_result->content_length, - include_result}; - } - - // Releases the given IncludeResult. - virtual void release_delegate( - glslang::TShader::Includer::IncludeResult* result) override { - if (result && result_releaser_) { - result_releaser_(user_data_, - static_cast(result->userData)); - } - delete result; - } - - const shaderc_include_resolve_fn resolver_; - const shaderc_include_result_release_fn result_releaser_; - void* user_data_; -}; - -// Converts the target env to the corresponding one in shaderc_util::Compiler. -shaderc_util::Compiler::TargetEnv GetCompilerTargetEnv(shaderc_target_env env) { - switch (env) { - case shaderc_target_env_opengl: - return shaderc_util::Compiler::TargetEnv::OpenGL; - case shaderc_target_env_opengl_compat: - return shaderc_util::Compiler::TargetEnv::OpenGLCompat; - case shaderc_target_env_webgpu: - assert(false); - break; - case shaderc_target_env_vulkan: - default: - break; - } - - return shaderc_util::Compiler::TargetEnv::Vulkan; -} - -shaderc_util::Compiler::TargetEnvVersion GetCompilerTargetEnvVersion( - uint32_t version_number) { - using namespace shaderc_util; - - if (static_cast(Compiler::TargetEnvVersion::Vulkan_1_0) == - version_number) { - return Compiler::TargetEnvVersion::Vulkan_1_0; - } - if (static_cast(Compiler::TargetEnvVersion::Vulkan_1_1) == - version_number) { - return Compiler::TargetEnvVersion::Vulkan_1_1; - } - if (static_cast(Compiler::TargetEnvVersion::Vulkan_1_2) == - version_number) { - return Compiler::TargetEnvVersion::Vulkan_1_2; - } - if (static_cast(Compiler::TargetEnvVersion::Vulkan_1_3) == - version_number) { - return Compiler::TargetEnvVersion::Vulkan_1_3; - } - if (static_cast(Compiler::TargetEnvVersion::OpenGL_4_5) == - version_number) { - return Compiler::TargetEnvVersion::OpenGL_4_5; - } - - return Compiler::TargetEnvVersion::Default; -} - -// Returns the Compiler::Limit enum for the given shaderc_limit enum. -shaderc_util::Compiler::Limit CompilerLimit(shaderc_limit limit) { - switch (limit) { -#define RESOURCE(NAME, FIELD, CNAME) \ - case shaderc_limit_##CNAME: \ - return shaderc_util::Compiler::Limit::NAME; -#include "libshaderc_util/resources.inc" -#undef RESOURCE - default: - break; - } - assert(0 && "Should not have reached here"); - return static_cast(0); -} - -// Returns the Compiler::UniformKind for the given shaderc_uniform_kind. -shaderc_util::Compiler::UniformKind GetUniformKind(shaderc_uniform_kind kind) { - switch (kind) { - case shaderc_uniform_kind_texture: - return shaderc_util::Compiler::UniformKind::Texture; - case shaderc_uniform_kind_sampler: - return shaderc_util::Compiler::UniformKind::Sampler; - case shaderc_uniform_kind_image: - return shaderc_util::Compiler::UniformKind::Image; - case shaderc_uniform_kind_buffer: - return shaderc_util::Compiler::UniformKind::Buffer; - case shaderc_uniform_kind_storage_buffer: - return shaderc_util::Compiler::UniformKind::StorageBuffer; - case shaderc_uniform_kind_unordered_access_view: - return shaderc_util::Compiler::UniformKind::UnorderedAccessView; - } - assert(0 && "Should not have reached here"); - return static_cast(0); -} - -// Returns the Compiler::Stage for generic stage values in shaderc_shader_kind. -shaderc_util::Compiler::Stage GetStage(shaderc_shader_kind kind) { - switch (kind) { - case shaderc_vertex_shader: - return shaderc_util::Compiler::Stage::Vertex; - case shaderc_fragment_shader: - return shaderc_util::Compiler::Stage::Fragment; - case shaderc_compute_shader: - return shaderc_util::Compiler::Stage::Compute; - case shaderc_tess_control_shader: - return shaderc_util::Compiler::Stage::TessControl; - case shaderc_tess_evaluation_shader: - return shaderc_util::Compiler::Stage::TessEval; - case shaderc_geometry_shader: - return shaderc_util::Compiler::Stage::Geometry; - default: - break; - } - assert(0 && "Should not have reached here"); - return static_cast(0); -} - -} // anonymous namespace - -struct shaderc_compile_options { - shaderc_target_env target_env = shaderc_target_env_default; - uint32_t target_env_version = 0; - shaderc_util::Compiler compiler; - shaderc_include_resolve_fn include_resolver = nullptr; - shaderc_include_result_release_fn include_result_releaser = nullptr; - void* include_user_data = nullptr; -}; - -shaderc_compile_options_t shaderc_compile_options_initialize() { - return new (std::nothrow) shaderc_compile_options; -} - -shaderc_compile_options_t shaderc_compile_options_clone( - const shaderc_compile_options_t options) { - if (!options) { - return shaderc_compile_options_initialize(); - } - return new (std::nothrow) shaderc_compile_options(*options); -} - -void shaderc_compile_options_release(shaderc_compile_options_t options) { - delete options; -} - -void shaderc_compile_options_add_macro_definition( - shaderc_compile_options_t options, const char* name, size_t name_length, - const char* value, size_t value_length) { - options->compiler.AddMacroDefinition(name, name_length, value, value_length); -} - -void shaderc_compile_options_set_source_language( - shaderc_compile_options_t options, shaderc_source_language set_lang) { - auto lang = shaderc_util::Compiler::SourceLanguage::GLSL; - if (set_lang == shaderc_source_language_hlsl) - lang = shaderc_util::Compiler::SourceLanguage::HLSL; - options->compiler.SetSourceLanguage(lang); -} - -void shaderc_compile_options_set_generate_debug_info( - shaderc_compile_options_t options) { - options->compiler.SetGenerateDebugInfo(); -} - -void shaderc_compile_options_set_optimization_level( - shaderc_compile_options_t options, shaderc_optimization_level level) { - auto opt_level = shaderc_util::Compiler::OptimizationLevel::Zero; - switch (level) { - case shaderc_optimization_level_size: - opt_level = shaderc_util::Compiler::OptimizationLevel::Size; - break; - case shaderc_optimization_level_performance: - opt_level = shaderc_util::Compiler::OptimizationLevel::Performance; - break; - default: - break; - } - - options->compiler.SetOptimizationLevel(opt_level); -} - -void shaderc_compile_options_set_forced_version_profile( - shaderc_compile_options_t options, int version, shaderc_profile profile) { - // Transfer the profile parameter from public enum type to glslang internal - // enum type. No default case here so that compiler will complain if new enum - // member is added later but not handled here. - switch (profile) { - case shaderc_profile_none: - options->compiler.SetForcedVersionProfile(version, ENoProfile); - break; - case shaderc_profile_core: - options->compiler.SetForcedVersionProfile(version, ECoreProfile); - break; - case shaderc_profile_compatibility: - options->compiler.SetForcedVersionProfile(version, ECompatibilityProfile); - break; - case shaderc_profile_es: - options->compiler.SetForcedVersionProfile(version, EEsProfile); - break; - } -} - -void shaderc_compile_options_set_include_callbacks( - shaderc_compile_options_t options, shaderc_include_resolve_fn resolver, - shaderc_include_result_release_fn result_releaser, void* user_data) { - options->include_resolver = resolver; - options->include_result_releaser = result_releaser; - options->include_user_data = user_data; -} - -void shaderc_compile_options_set_suppress_warnings( - shaderc_compile_options_t options) { - options->compiler.SetSuppressWarnings(); -} - -void shaderc_compile_options_set_target_env(shaderc_compile_options_t options, - shaderc_target_env target, - uint32_t version) { - options->target_env = target; - options->compiler.SetTargetEnv(GetCompilerTargetEnv(target), - GetCompilerTargetEnvVersion(version)); -} - -void shaderc_compile_options_set_target_spirv(shaderc_compile_options_t options, - shaderc_spirv_version ver) { - // We made the values match, so we can get away with a static cast. - options->compiler.SetTargetSpirv( - static_cast(ver)); -} - -void shaderc_compile_options_set_warnings_as_errors( - shaderc_compile_options_t options) { - options->compiler.SetWarningsAsErrors(); -} - -void shaderc_compile_options_set_limit(shaderc_compile_options_t options, - shaderc_limit limit, int value) { - options->compiler.SetLimit(CompilerLimit(limit), value); -} - -void shaderc_compile_options_set_auto_bind_uniforms( - shaderc_compile_options_t options, bool auto_bind) { - options->compiler.SetAutoBindUniforms(auto_bind); -} - -void shaderc_compile_options_set_auto_combined_image_sampler( - shaderc_compile_options_t options, bool upgrade) { - options->compiler.SetAutoCombinedImageSampler(upgrade); -} - -void shaderc_compile_options_set_hlsl_io_mapping( - shaderc_compile_options_t options, bool hlsl_iomap) { - options->compiler.SetHlslIoMapping(hlsl_iomap); -} - -void shaderc_compile_options_set_hlsl_offsets(shaderc_compile_options_t options, - bool hlsl_offsets) { - options->compiler.SetHlslOffsets(hlsl_offsets); -} - -void shaderc_compile_options_set_binding_base(shaderc_compile_options_t options, - shaderc_uniform_kind kind, - uint32_t base) { - options->compiler.SetAutoBindingBase(GetUniformKind(kind), base); -} - -void shaderc_compile_options_set_binding_base_for_stage( - shaderc_compile_options_t options, shaderc_shader_kind shader_kind, - shaderc_uniform_kind kind, uint32_t base) { - options->compiler.SetAutoBindingBaseForStage(GetStage(shader_kind), - GetUniformKind(kind), base); -} - -void shaderc_compile_options_set_auto_map_locations( - shaderc_compile_options_t options, bool auto_map) { - options->compiler.SetAutoMapLocations(auto_map); -} - -void shaderc_compile_options_set_hlsl_register_set_and_binding_for_stage( - shaderc_compile_options_t options, shaderc_shader_kind shader_kind, - const char* reg, const char* set, const char* binding) { - options->compiler.SetHlslRegisterSetAndBindingForStage(GetStage(shader_kind), - reg, set, binding); -} - -void shaderc_compile_options_set_hlsl_register_set_and_binding( - shaderc_compile_options_t options, const char* reg, const char* set, - const char* binding) { - options->compiler.SetHlslRegisterSetAndBinding(reg, set, binding); -} - -void shaderc_compile_options_set_hlsl_functionality1( - shaderc_compile_options_t options, bool enable) { - options->compiler.EnableHlslFunctionality1(enable); -} - -void shaderc_compile_options_set_invert_y( - shaderc_compile_options_t options, bool enable) { - options->compiler.EnableInvertY(enable); -} - -void shaderc_compile_options_set_nan_clamp(shaderc_compile_options_t options, - bool enable) { - options->compiler.SetNanClamp(enable); -} - -shaderc_compiler_t shaderc_compiler_initialize() { - shaderc_compiler_t compiler = new (std::nothrow) shaderc_compiler; - if (compiler) { - compiler->initializer.reset(new shaderc_util::GlslangInitializer); - } - return compiler; -} - -void shaderc_compiler_release(shaderc_compiler_t compiler) { - delete compiler; -} - -namespace { -shaderc_compilation_result_t CompileToSpecifiedOutputType( - const shaderc_compiler_t compiler, const char* source_text, - size_t source_text_size, shaderc_shader_kind shader_kind, - const char* input_file_name, const char* entry_point_name, - const shaderc_compile_options_t additional_options, - shaderc_util::Compiler::OutputType output_type) { - auto* result = new (std::nothrow) shaderc_compilation_result_vector; - if (!result) return nullptr; - - if (!input_file_name) { - result->messages = "Input file name string was null."; - result->num_errors = 1; - result->compilation_status = shaderc_compilation_status_compilation_error; - return result; - } - result->compilation_status = shaderc_compilation_status_invalid_stage; - bool compilation_succeeded = false; // In case we exit early. - std::vector compilation_output_data; - size_t compilation_output_data_size_in_bytes = 0u; - if (!compiler->initializer) return result; - TRY_IF_EXCEPTIONS_ENABLED { - std::stringstream errors; - size_t total_warnings = 0; - size_t total_errors = 0; - std::string input_file_name_str(input_file_name); - EShLanguage forced_stage = GetForcedStage(shader_kind); - shaderc_util::string_piece source_string = - shaderc_util::string_piece(source_text, source_text + source_text_size); - StageDeducer stage_deducer(shader_kind); - if (additional_options) { - InternalFileIncluder includer(additional_options->include_resolver, - additional_options->include_result_releaser, - additional_options->include_user_data); - // Depends on return value optimization to avoid extra copy. - std::tie(compilation_succeeded, compilation_output_data, - compilation_output_data_size_in_bytes) = - additional_options->compiler.Compile( - source_string, forced_stage, input_file_name_str, entry_point_name, - // stage_deducer has a flag: error_, which we need to check later. - // We need to make this a reference wrapper, so that std::function - // won't make a copy for this callable object. - std::ref(stage_deducer), includer, output_type, &errors, - &total_warnings, &total_errors); - } else { - // Compile with default options. - InternalFileIncluder includer; - std::tie(compilation_succeeded, compilation_output_data, - compilation_output_data_size_in_bytes) = - shaderc_util::Compiler().Compile( - source_string, forced_stage, input_file_name_str, entry_point_name, - std::ref(stage_deducer), includer, output_type, &errors, - &total_warnings, &total_errors); - } - - result->messages = errors.str(); - result->SetOutputData(std::move(compilation_output_data)); - result->output_data_size = compilation_output_data_size_in_bytes; - result->num_warnings = total_warnings; - result->num_errors = total_errors; - if (compilation_succeeded) { - result->compilation_status = shaderc_compilation_status_success; - } else { - // Check whether the error is caused by failing to deduce the shader - // stage. If it is the case, set the error type to shader kind error. - // Otherwise, set it to compilation error. - result->compilation_status = - stage_deducer.error() ? shaderc_compilation_status_invalid_stage - : shaderc_compilation_status_compilation_error; - } - } - CATCH_IF_EXCEPTIONS_ENABLED(...) { - result->compilation_status = shaderc_compilation_status_internal_error; - } - return result; -} -} // anonymous namespace - -shaderc_compilation_result_t shaderc_compile_into_spv( - const shaderc_compiler_t compiler, const char* source_text, - size_t source_text_size, shaderc_shader_kind shader_kind, - const char* input_file_name, const char* entry_point_name, - const shaderc_compile_options_t additional_options) { - return CompileToSpecifiedOutputType( - compiler, source_text, source_text_size, shader_kind, input_file_name, - entry_point_name, additional_options, - shaderc_util::Compiler::OutputType::SpirvBinary); -} - -shaderc_compilation_result_t shaderc_compile_into_spv_assembly( - const shaderc_compiler_t compiler, const char* source_text, - size_t source_text_size, shaderc_shader_kind shader_kind, - const char* input_file_name, const char* entry_point_name, - const shaderc_compile_options_t additional_options) { - return CompileToSpecifiedOutputType( - compiler, source_text, source_text_size, shader_kind, input_file_name, - entry_point_name, additional_options, - shaderc_util::Compiler::OutputType::SpirvAssemblyText); -} - -shaderc_compilation_result_t shaderc_compile_into_preprocessed_text( - const shaderc_compiler_t compiler, const char* source_text, - size_t source_text_size, shaderc_shader_kind shader_kind, - const char* input_file_name, const char* entry_point_name, - const shaderc_compile_options_t additional_options) { - return CompileToSpecifiedOutputType( - compiler, source_text, source_text_size, shader_kind, input_file_name, - entry_point_name, additional_options, - shaderc_util::Compiler::OutputType::PreprocessedText); -} - -shaderc_compilation_result_t shaderc_assemble_into_spv( - const shaderc_compiler_t compiler, const char* source_assembly, - size_t source_assembly_size, - const shaderc_compile_options_t additional_options) { - auto* result = new (std::nothrow) shaderc_compilation_result_spv_binary; - if (!result) return nullptr; - result->compilation_status = shaderc_compilation_status_invalid_assembly; - if (!compiler->initializer) return result; - if (source_assembly == nullptr) return result; - - TRY_IF_EXCEPTIONS_ENABLED { - spv_binary assembling_output_data = nullptr; - std::string errors; - const auto target_env = additional_options ? additional_options->target_env - : shaderc_target_env_default; - const uint32_t target_env_version = - additional_options ? additional_options->target_env_version : 0; - const bool assembling_succeeded = shaderc_util::SpirvToolsAssemble( - GetCompilerTargetEnv(target_env), - GetCompilerTargetEnvVersion(target_env_version), - {source_assembly, source_assembly + source_assembly_size}, - &assembling_output_data, &errors); - result->num_errors = !assembling_succeeded; - if (assembling_succeeded) { - result->SetOutputData(assembling_output_data); - result->output_data_size = - assembling_output_data->wordCount * sizeof(uint32_t); - result->compilation_status = shaderc_compilation_status_success; - } else { - result->messages = std::move(errors); - result->compilation_status = shaderc_compilation_status_invalid_assembly; - } - } - CATCH_IF_EXCEPTIONS_ENABLED(...) { - result->compilation_status = shaderc_compilation_status_internal_error; - } - - return result; -} - -size_t shaderc_result_get_length(const shaderc_compilation_result_t result) { - return result->output_data_size; -} - -size_t shaderc_result_get_num_warnings( - const shaderc_compilation_result_t result) { - return result->num_warnings; -} - -size_t shaderc_result_get_num_errors( - const shaderc_compilation_result_t result) { - return result->num_errors; -} - -const char* shaderc_result_get_bytes( - const shaderc_compilation_result_t result) { - return result->GetBytes(); -} - -void shaderc_result_release(shaderc_compilation_result_t result) { - delete result; -} - -const char* shaderc_result_get_error_message( - const shaderc_compilation_result_t result) { - return result->messages.c_str(); -} - -shaderc_compilation_status shaderc_result_get_compilation_status( - const shaderc_compilation_result_t result) { - return result->compilation_status; -} - -void shaderc_get_spv_version(unsigned int* version, unsigned int* revision) { - *version = spv::Version; - *revision = spv::Revision; -} - -bool shaderc_parse_version_profile(const char* str, int* version, - shaderc_profile* profile) { - EProfile glslang_profile; - bool success = shaderc_util::ParseVersionProfile( - std::string(str, strlen(str)), version, &glslang_profile); - if (!success) return false; - - switch (glslang_profile) { - case EEsProfile: - *profile = shaderc_profile_es; - return true; - case ECoreProfile: - *profile = shaderc_profile_core; - return true; - case ECompatibilityProfile: - *profile = shaderc_profile_compatibility; - return true; - case ENoProfile: - *profile = shaderc_profile_none; - return true; - case EBadProfile: - case EProfileCount: - return false; - } - - // Shouldn't reach here, all profile enum should be handled above. - // Be strict to return false. - return false; -} diff --git a/lib/shaderc/libshaderc/src/shaderc_c_smoke_test.c b/lib/shaderc/libshaderc/src/shaderc_c_smoke_test.c deleted file mode 100644 index 80c40486d..000000000 --- a/lib/shaderc/libshaderc/src/shaderc_c_smoke_test.c +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "shaderc/shaderc.h" -#include -#include - -// Because we want to test this as a plain old C file, we cannot use -// gtest, so just run a simple smoke test. - -int main() { - const char* test_program = - "#version 310 es\n" - "layout(location = 0) in highp vec4 vtxColor;\n" - "layout(location = 0) out highp vec4 outColor;\n" - "void main() {\n" - " outColor = vtxColor;" - "}\n"; - shaderc_compiler_t compiler; - shaderc_compilation_result_t result; - shaderc_compile_options_t options; - - compiler = shaderc_compiler_initialize(); - options = shaderc_compile_options_initialize(); - shaderc_compile_options_add_macro_definition(options, "FOO", 3, "1", 1); - result = shaderc_compile_into_spv( - compiler, test_program, strlen(test_program), - shaderc_glsl_fragment_shader, "a.glsl", "main", options); - - assert(result); - - if (shaderc_result_get_compilation_status(result) != - shaderc_compilation_status_success) { - // Early exit on failure. - return -1; - } - shaderc_result_release(result); - shaderc_compile_options_release(options); - shaderc_compiler_release(compiler); - - return 0; -} - diff --git a/lib/shaderc/libshaderc/src/shaderc_cpp_test.cc b/lib/shaderc/libshaderc/src/shaderc_cpp_test.cc deleted file mode 100644 index 31667044c..000000000 --- a/lib/shaderc/libshaderc/src/shaderc_cpp_test.cc +++ /dev/null @@ -1,1463 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include - -#include -#include -#include - -#include "common_shaders_for_test.h" -#include "shaderc/shaderc.hpp" -#include "spirv-tools/libspirv.hpp" -#include "spirv/unified1/spirv.hpp" - -namespace { - -using shaderc::AssemblyCompilationResult; -using shaderc::CompileOptions; -using shaderc::PreprocessedSourceCompilationResult; -using shaderc::SpvCompilationResult; -using testing::Each; -using testing::Eq; -using testing::HasSubstr; -using testing::Not; - -// Helper function to check if the compilation result indicates a successful -// compilation. -template -bool CompilationResultIsSuccess(const shaderc::CompilationResult& result) { - return result.GetCompilationStatus() == shaderc_compilation_status_success; -} - -// Examines whether a compilation result has valid SPIR-V code, by checking the -// magic number in the fixed postion of the byte array in the result object. -// Returns true if the magic number is found at the correct postion, otherwise -// returns false. -bool IsValidSpv(const SpvCompilationResult& result) { - if (!CompilationResultIsSuccess(result)) return false; - size_t length_in_words = result.cend() - result.cbegin(); - if (length_in_words < 5) return false; - const uint32_t* bytes = result.cbegin(); - return bytes[0] == spv::MagicNumber; -} - -// Compiles a shader and returns true if the result is valid SPIR-V. The -// input_file_name is set to "shader". -bool CompilesToValidSpv(const shaderc::Compiler& compiler, - const std::string& shader, shaderc_shader_kind kind) { - return IsValidSpv(compiler.CompileGlslToSpv(shader, kind, "shader")); -} - -// Compiles a shader with options and returns true if the result is valid -// SPIR-V. The input_file_name is set to "shader". -bool CompilesToValidSpv(const shaderc::Compiler& compiler, - const std::string& shader, shaderc_shader_kind kind, - const CompileOptions& options) { - return IsValidSpv(compiler.CompileGlslToSpv(shader, kind, "shader", options)); -} - -// Returns the compiler's output from a compilation result as a string. -template -std::string CompilerOutputAsString( - const shaderc::CompilationResult& result) { - return std::string(reinterpret_cast(result.cbegin()), - reinterpret_cast(result.cend())); -} - -class CppInterface : public testing::Test { - protected: - // Compiles a shader and returns true on success, false on failure. - // The input file name is set to "shader" by default. - bool CompilationSuccess(const std::string& shader, - shaderc_shader_kind kind) const { - return compiler_ - .CompileGlslToSpv(shader.c_str(), shader.length(), kind, - "shader") - .GetCompilationStatus() == shaderc_compilation_status_success; - } - - // Compiles a shader with options and returns true on success, false on - // failure. - // The input file name is set to "shader" by default. - bool CompilationSuccess(const std::string& shader, shaderc_shader_kind kind, - const CompileOptions& options) const { - return compiler_ - .CompileGlslToSpv(shader.c_str(), shader.length(), kind, - "shader", options) - .GetCompilationStatus() == shaderc_compilation_status_success; - } - - // Compiles a shader, asserts compilation success, and returns the warning - // messages. - // The input file name is set to "shader" by default. - std::string CompilationWarnings( - const std::string& shader, shaderc_shader_kind kind, - // This could default to options_, but that can - // be easily confused with a no-options-provided - // case: - const CompileOptions& options) { - const auto compilation_result = - compiler_.CompileGlslToSpv(shader, kind, "shader", options); - EXPECT_TRUE(CompilationResultIsSuccess(compilation_result)) << kind << '\n' - << shader; - return compilation_result.GetErrorMessage(); - } - - // Compiles a shader, asserts compilation fail, and returns the error - // messages. - std::string CompilationErrors(const std::string& shader, - shaderc_shader_kind kind, - // This could default to options_, but that can - // be easily confused with a no-options-provided - // case: - const CompileOptions& options) { - const auto compilation_result = - compiler_.CompileGlslToSpv(shader, kind, "shader", options); - EXPECT_FALSE(CompilationResultIsSuccess(compilation_result)) << kind << '\n' - << shader; - return compilation_result.GetErrorMessage(); - } - - // Assembles the given SPIR-V assembly and returns true on success. - bool AssemblingSuccess(const std::string& shader, - const CompileOptions& options) const { - return compiler_.AssembleToSpv(shader, options).GetCompilationStatus() == - shaderc_compilation_status_success; - } - - // Assembles the given SPIR-V assembly and returns true if the result contains - // a valid SPIR-V module. - bool AssemblingValid(const std::string& shader, - const CompileOptions& options) const { - return IsValidSpv(compiler_.AssembleToSpv(shader, options)); - } - - // Compiles a shader, expects compilation success, and returns the output - // bytes. - // The input file name is set to "shader" by default. - std::string CompilationOutput(const std::string& shader, - shaderc_shader_kind kind, - const CompileOptions& options) const { - const auto compilation_result = - compiler_.CompileGlslToSpv(shader, kind, "shader", options); - EXPECT_TRUE(CompilationResultIsSuccess(compilation_result)) << kind << '\n'; - // Need to make sure you get complete binary data, including embedded nulls. - return CompilerOutputAsString(compilation_result); - } - - // Compiles a shader to SPIR-V assembly, expects compilation success, and - // returns the output bytes. - // The input file name is set to "shader" by default. - std::string AssemblyOutput(const std::string& shader, - shaderc_shader_kind kind, - const CompileOptions& options) const { - const auto compilation_result = - compiler_.CompileGlslToSpvAssembly(shader, kind, "shader", options); - EXPECT_TRUE(CompilationResultIsSuccess(compilation_result)) << kind << '\n'; - // Need to make sure you get complete binary data, including embedded nulls. - return CompilerOutputAsString(compilation_result); - } - - // For compiling shaders in subclass tests: - shaderc::Compiler compiler_; - CompileOptions options_; -}; - -TEST_F(CppInterface, CompilerValidUponConstruction) { - EXPECT_TRUE(compiler_.IsValid()); -} - -TEST_F(CppInterface, MultipleCalls) { - shaderc::Compiler compiler1, compiler2, compiler3; - EXPECT_TRUE(compiler1.IsValid()); - EXPECT_TRUE(compiler2.IsValid()); - EXPECT_TRUE(compiler3.IsValid()); -} - -#ifndef SHADERC_DISABLE_THREADED_TESTS -TEST_F(CppInterface, MultipleThreadsInitializing) { - std::unique_ptr compiler1; - std::unique_ptr compiler2; - std::unique_ptr compiler3; - std::thread t1([&compiler1]() { - compiler1 = std::unique_ptr(new shaderc::Compiler()); - }); - std::thread t2([&compiler2]() { - compiler2 = std::unique_ptr(new shaderc::Compiler()); - }); - std::thread t3([&compiler3]() { - compiler3 = std::unique_ptr(new shaderc::Compiler()); - }); - t1.join(); - t2.join(); - t3.join(); - EXPECT_TRUE(compiler1->IsValid()); - EXPECT_TRUE(compiler2->IsValid()); - EXPECT_TRUE(compiler3->IsValid()); -} -#endif - -TEST_F(CppInterface, CompilerMoves) { - shaderc::Compiler compiler2(std::move(compiler_)); - ASSERT_FALSE(compiler_.IsValid()); - ASSERT_TRUE(compiler2.IsValid()); -} - -TEST_F(CppInterface, EmptyString) { - EXPECT_FALSE(CompilationSuccess("", shaderc_glsl_vertex_shader)); - EXPECT_FALSE(CompilationSuccess("", shaderc_glsl_fragment_shader)); -} - -TEST_F(CppInterface, AssembleEmptyString) { - EXPECT_TRUE(AssemblingSuccess("", options_)); -} - -TEST_F(CppInterface, ResultObjectMoves) { - SpvCompilationResult result = compiler_.CompileGlslToSpv( - kMinimalShader, shaderc_glsl_vertex_shader, "shader"); - EXPECT_TRUE(CompilationResultIsSuccess(result)); - const SpvCompilationResult result2(std::move(result)); - EXPECT_FALSE(CompilationResultIsSuccess(result)); - EXPECT_TRUE(CompilationResultIsSuccess(result2)); -} - -TEST_F(CppInterface, GarbageString) { - EXPECT_FALSE(CompilationSuccess("jfalkds", shaderc_glsl_vertex_shader)); - EXPECT_FALSE(CompilationSuccess("jfalkds", shaderc_glsl_fragment_shader)); -} - -TEST_F(CppInterface, AssembleGarbageString) { - const auto result = compiler_.AssembleToSpv("jfalkds", options_); - EXPECT_FALSE(CompilationResultIsSuccess(result)); - EXPECT_EQ(0u, result.GetNumWarnings()); - EXPECT_EQ(1u, result.GetNumErrors()); -} - -// TODO(antiagainst): right now there is no assembling difference for all the -// target environments exposed by shaderc. So the following is just testing the -// target environment is accepted. -TEST_F(CppInterface, AssembleTargetEnv) { - options_.SetTargetEnvironment(shaderc_target_env_opengl, 0); - EXPECT_TRUE(AssemblingValid("OpCapability Shader", options_)); -} - -TEST_F(CppInterface, MinimalShader) { - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_vertex_shader)); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_fragment_shader)); -} - -TEST_F(CppInterface, AssembleMinimalShader) { - EXPECT_TRUE(AssemblingValid(kMinimalShaderAssembly, options_)); -} - -TEST_F(CppInterface, BasicOptions) { - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_vertex_shader, options_)); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_fragment_shader, options_)); -} - -TEST_F(CppInterface, CopiedOptions) { - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_vertex_shader, options_)); - CompileOptions copied_options(options_); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_fragment_shader, copied_options)); -} - -TEST_F(CppInterface, MovedOptions) { - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_vertex_shader, options_)); - CompileOptions copied_options(std::move(options_)); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_fragment_shader, copied_options)); -} - -TEST_F(CppInterface, StdAndCString) { - const SpvCompilationResult result1 = - compiler_.CompileGlslToSpv(kMinimalShader, strlen(kMinimalShader), - shaderc_glsl_fragment_shader, "shader"); - const SpvCompilationResult result2 = compiler_.CompileGlslToSpv( - std::string(kMinimalShader), shaderc_glsl_fragment_shader, "shader"); - EXPECT_TRUE(CompilationResultIsSuccess(result1)); - EXPECT_TRUE(CompilationResultIsSuccess(result2)); - EXPECT_EQ(std::vector(result1.cbegin(), result1.cend()), - std::vector(result2.cbegin(), result2.cend())); -} - -TEST_F(CppInterface, ErrorsReported) { - const SpvCompilationResult result = compiler_.CompileGlslToSpv( - "int f(){return wrongname;}", shaderc_glsl_vertex_shader, "shader"); - ASSERT_FALSE(CompilationResultIsSuccess(result)); - EXPECT_THAT(result.GetErrorMessage(), HasSubstr("wrongname")); -} - -#ifndef SHADERC_DISABLE_THREADED_TESTS -TEST_F(CppInterface, MultipleThreadsCalling) { - bool results[10]; - std::vector threads; - for (auto& r : results) { - threads.emplace_back([this, &r]() { - r = CompilationSuccess(kMinimalShader, shaderc_glsl_vertex_shader); - }); - } - for (auto& t : threads) { - t.join(); - } - EXPECT_THAT(results, Each(true)); -} -#endif - -TEST_F(CppInterface, AccessorsOnNullResultObject) { - const SpvCompilationResult result(nullptr); - EXPECT_FALSE(CompilationResultIsSuccess(result)); - EXPECT_EQ(std::string(), result.GetErrorMessage()); - EXPECT_EQ(result.cend(), result.cbegin()); - EXPECT_EQ(nullptr, result.cbegin()); - EXPECT_EQ(nullptr, result.cend()); - EXPECT_EQ(nullptr, result.begin()); - EXPECT_EQ(nullptr, result.end()); -} - -TEST_F(CppInterface, MacroCompileOptions) { - options_.AddMacroDefinition("E", "main"); - const std::string kMinimalExpandedShader = "#version 150\nvoid E(){}"; - const std::string kMinimalDoubleExpandedShader = "#version 150\nF E(){}"; - EXPECT_TRUE(CompilationSuccess(kMinimalExpandedShader, - shaderc_glsl_vertex_shader, options_)); - - CompileOptions cloned_options(options_); - // The simplest should still compile with the cloned options. - EXPECT_TRUE(CompilationSuccess(kMinimalExpandedShader, - shaderc_glsl_vertex_shader, cloned_options)); - - EXPECT_FALSE(CompilationSuccess(kMinimalDoubleExpandedShader, - shaderc_glsl_vertex_shader, cloned_options)); - - cloned_options.AddMacroDefinition("F", "void"); - // This should still not work with the original options. - EXPECT_FALSE(CompilationSuccess(kMinimalDoubleExpandedShader, - shaderc_glsl_vertex_shader, options_)); - // This should work with the cloned options that have the additional - // parameter. - EXPECT_TRUE(CompilationSuccess(kMinimalDoubleExpandedShader, - shaderc_glsl_vertex_shader, cloned_options)); -} - -TEST_F(CppInterface, D_DisassemblyOption) { - const AssemblyCompilationResult result = compiler_.CompileGlslToSpvAssembly( - kMinimalShader, shaderc_glsl_vertex_shader, "shader", options_); - EXPECT_TRUE(CompilationResultIsSuccess(result)); - // This should work with both the glslang disassembly format and the - // SPIR-V Tools assembly format. - EXPECT_THAT(CompilerOutputAsString(result), HasSubstr("Capability Shader")); - EXPECT_THAT(CompilerOutputAsString(result), HasSubstr("MemoryModel")); - - CompileOptions cloned_options(options_); - auto result_from_cloned_options = compiler_.CompileGlslToSpvAssembly( - kMinimalShader, shaderc_glsl_vertex_shader, "shader", cloned_options); - EXPECT_TRUE(CompilationResultIsSuccess(result_from_cloned_options)); - // The mode should be carried into any clone of the original option object. - EXPECT_THAT(CompilerOutputAsString(result_from_cloned_options), - HasSubstr("Capability Shader")); - EXPECT_THAT(CompilerOutputAsString(result_from_cloned_options), - HasSubstr("MemoryModel")); -} - -TEST_F(CppInterface, DisassembleMinimalShader) { - const AssemblyCompilationResult result = compiler_.CompileGlslToSpvAssembly( - kMinimalShader, shaderc_glsl_vertex_shader, "shader", options_); - EXPECT_TRUE(CompilationResultIsSuccess(result)); - for (const auto& substring : kMinimalShaderDisassemblySubstrings) { - EXPECT_THAT(CompilerOutputAsString(result), HasSubstr(substring)); - } -} - -TEST_F(CppInterface, ForcedVersionProfileCorrectStd) { - // Forces the version and profile to 450core, which fixes the missing - // #version. - options_.SetForcedVersionProfile(450, shaderc_profile_core); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kCoreVertShaderWithoutVersion, - shaderc_glsl_vertex_shader, options_)); -} - -TEST_F(CppInterface, ForcedVersionProfileCorrectStdClonedOptions) { - // Forces the version and profile to 450core, which fixes the missing - // #version. - options_.SetForcedVersionProfile(450, shaderc_profile_core); - CompileOptions cloned_options(options_); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kCoreVertShaderWithoutVersion, - shaderc_glsl_vertex_shader, cloned_options)); -} - -TEST_F(CppInterface, ForcedVersionProfileInvalidModule) { - // Forces the version and profile to 310es, while the source module is invalid - // for this version of GLSL. Compilation should fail. - options_.SetForcedVersionProfile(310, shaderc_profile_es); - EXPECT_THAT(CompilationErrors(kCoreVertShaderWithoutVersion, - shaderc_glsl_vertex_shader, options_), - HasSubstr("error: 'gl_ClipDistance' : undeclared identifier\n")); -} - -TEST_F(CppInterface, ForcedVersionProfileConflictingStd) { - // Forces the version and profile to 450core, which is in conflict with the - // #version in shader. - const std::string kVertexShader = - std::string("#version 310 es\n") + kCoreVertShaderWithoutVersion; - options_.SetForcedVersionProfile(450, shaderc_profile_core); - EXPECT_THAT( - CompilationWarnings(kVertexShader, shaderc_glsl_vertex_shader, options_), - HasSubstr("warning: (version, profile) forced to be (450, core), " - "while in source code it is (310, es)\n")); -} - -TEST_F(CppInterface, ForcedVersionProfileUnknownVersionStd) { - // Forces the version and profile to 4242core, which is an unknown version. - options_.SetForcedVersionProfile(4242 /*unknown version*/, - shaderc_profile_core); - auto const errs = - CompilationErrors(kMinimalShader, shaderc_glsl_vertex_shader, options_); - EXPECT_THAT(errs, - HasSubstr("warning: (version, profile) forced to be (4242, core)," - " while in source code it is (140, none)\n")); - EXPECT_THAT(errs, HasSubstr("error: version not supported\n")); -} - -TEST_F(CppInterface, ForcedVersionProfileVersionsBefore150) { - // Versions before 150 do not allow a profile token, shaderc_profile_none - // should be passed down as the profile parameter. - options_.SetForcedVersionProfile(140, shaderc_profile_none); - EXPECT_TRUE( - CompilationSuccess(kMinimalShader, shaderc_glsl_vertex_shader, options_)); -} - -TEST_F(CppInterface, ForcedVersionProfileRedundantProfileStd) { - // Forces the version and profile to 100core. But versions before 150 do not - // allow a profile token, compilation should fail. - options_.SetForcedVersionProfile(100, shaderc_profile_core); - EXPECT_THAT( - CompilationErrors(kMinimalShader, shaderc_glsl_vertex_shader, options_), - HasSubstr("error: #version: versions before 150 do not allow a profile " - "token\n")); -} - -TEST_F(CppInterface, GenerateDebugInfoBinary) { - options_.SetGenerateDebugInfo(); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, options_); - // The binary output should contain the name of the vector (debug_info_sample) - // null-terminated, as well as the whole original source. - std::string vector_name("debug_info_sample"); - vector_name.resize(vector_name.size() + 1); - EXPECT_THAT(binary_output, HasSubstr(vector_name)); - EXPECT_THAT(binary_output, HasSubstr(kMinimalDebugInfoShader)); -} - -TEST_F(CppInterface, GenerateDebugInfoBinaryClonedOptions) { - options_.SetGenerateDebugInfo(); - CompileOptions cloned_options(options_); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, cloned_options); - // The binary output should contain the name of the vector (debug_info_sample) - // null-terminated, as well as the whole original source. - std::string vector_name("debug_info_sample"); - vector_name.resize(vector_name.size() + 1); - EXPECT_THAT(binary_output, HasSubstr(vector_name)); - EXPECT_THAT(binary_output, HasSubstr(kMinimalDebugInfoShader)); -} - -TEST_F(CppInterface, GenerateDebugInfoDisassembly) { - options_.SetGenerateDebugInfo(); - // Debug info should also be emitted in disassembly mode. - // The output disassembly should contain the name of the vector: - // debug_info_sample. - EXPECT_THAT(AssemblyOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, options_), - HasSubstr("debug_info_sample")); -} - -TEST_F(CppInterface, GenerateDebugInfoDisassemblyClonedOptions) { - options_.SetGenerateDebugInfo(); - // Generate debug info mode should be carried to the cloned options. - CompileOptions cloned_options(options_); - EXPECT_THAT(CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, cloned_options), - HasSubstr("debug_info_sample")); -} - -TEST_F(CppInterface, CompileAndOptimizeWithLevelZero) { - options_.SetOptimizationLevel(shaderc_optimization_level_zero); - const std::string disassembly_text = - AssemblyOutput(kMinimalShader, shaderc_glsl_vertex_shader, options_); - for (const auto& substring : kMinimalShaderDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we still have debug instructions. - EXPECT_THAT(disassembly_text, HasSubstr("OpName")); - EXPECT_THAT(disassembly_text, HasSubstr("OpSource")); -} - -TEST_F(CppInterface, CompileAndOptimizeWithLevelPerformance) { - options_.SetOptimizationLevel(shaderc_optimization_level_performance); - const std::string disassembly_text = AssemblyOutput( - kGlslMultipleFnShader, shaderc_glsl_fragment_shader, options_); - // Check that we do not have function calls anymore. - EXPECT_THAT(disassembly_text, Not(HasSubstr("OpFunctionCall"))); -} - -TEST_F(CppInterface, CompileAndOptimizeWithLevelSize) { - options_.SetOptimizationLevel(shaderc_optimization_level_size); - const std::string disassembly_text = - AssemblyOutput(kMinimalShader, shaderc_glsl_vertex_shader, options_); - for (const auto& substring : kMinimalShaderDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we do not have debug instructions. - EXPECT_THAT(disassembly_text, Not(HasSubstr("OpName"))); - EXPECT_THAT(disassembly_text, Not(HasSubstr("OpSource"))); -} - -TEST_F(CppInterface, CompileAndOptimizeForVulkan10Failure) { - options_.SetSourceLanguage(shaderc_source_language_hlsl); - options_.SetTargetEnvironment(shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - options_.SetOptimizationLevel(shaderc_optimization_level_performance); - - EXPECT_THAT(CompilationErrors(kHlslWaveActiveSumeComputeShader, - shaderc_compute_shader, options_), - // TODO(antiagainst): the error message can be improved to be more - // explicit regarding Vulkan 1.1 - HasSubstr("compilation succeeded but failed to optimize: " - "Invalid capability operand")); -} - -TEST_F(CppInterface, CompileAndOptimizeForVulkan11Success) { - options_.SetSourceLanguage(shaderc_source_language_hlsl); - options_.SetTargetEnvironment(shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - options_.SetOptimizationLevel(shaderc_optimization_level_performance); - - const std::string disassembly_text = AssemblyOutput( - kHlslWaveActiveSumeComputeShader, shaderc_compute_shader, options_); - EXPECT_THAT(disassembly_text, HasSubstr("OpGroupNonUniformIAdd")); -} - -TEST_F(CppInterface, FollowingOptLevelOverridesPreviousOne) { - options_.SetOptimizationLevel(shaderc_optimization_level_size); - // Optimization level settings overridden by - options_.SetOptimizationLevel(shaderc_optimization_level_zero); - const std::string disassembly_text = - AssemblyOutput(kMinimalShader, shaderc_glsl_vertex_shader, options_); - for (const auto& substring : kMinimalShaderDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we still have debug instructions. - EXPECT_THAT(disassembly_text, HasSubstr("OpName")); - EXPECT_THAT(disassembly_text, HasSubstr("OpSource")); -} - -TEST_F(CppInterface, GenerateDebugInfoOverridesOptimizationLevel) { - options_.SetOptimizationLevel(shaderc_optimization_level_size); - // Optimization level settings overridden by - options_.SetGenerateDebugInfo(); - const std::string disassembly_text = - AssemblyOutput(kMinimalShader, shaderc_glsl_vertex_shader, options_); - for (const auto& substring : kMinimalShaderDebugInfoDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we still have debug instructions. - EXPECT_THAT(disassembly_text, HasSubstr("OpName")); - EXPECT_THAT(disassembly_text, HasSubstr("OpSource")); -} - -TEST_F(CppInterface, GenerateDebugInfoProhibitsOptimizationLevel) { - // Setting generate debug info first also works. - options_.SetGenerateDebugInfo(); - options_.SetOptimizationLevel(shaderc_optimization_level_size); - const std::string disassembly_text = - AssemblyOutput(kMinimalShader, shaderc_glsl_vertex_shader, options_); - for (const auto& substring : kMinimalShaderDebugInfoDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we still have debug instructions. - EXPECT_THAT(disassembly_text, HasSubstr("OpName")); - EXPECT_THAT(disassembly_text, HasSubstr("OpSource")); -} - -TEST_F(CppInterface, GetNumErrors) { - std::string shader(kTwoErrorsShader); - const SpvCompilationResult compilation_result = - compiler_.CompileGlslToSpv(kTwoErrorsShader, strlen(kTwoErrorsShader), - shaderc_glsl_vertex_shader, "shader"); - EXPECT_FALSE(CompilationResultIsSuccess(compilation_result)); - EXPECT_EQ(2u, compilation_result.GetNumErrors()); - EXPECT_EQ(0u, compilation_result.GetNumWarnings()); -} - -TEST_F(CppInterface, GetNumWarnings) { - const SpvCompilationResult compilation_result = - compiler_.CompileGlslToSpv(kTwoWarningsShader, strlen(kTwoWarningsShader), - shaderc_glsl_vertex_shader, "shader"); - EXPECT_TRUE(CompilationResultIsSuccess(compilation_result)); - EXPECT_EQ(2u, compilation_result.GetNumWarnings()); - EXPECT_EQ(0u, compilation_result.GetNumErrors()); -} - -TEST_F(CppInterface, ZeroErrorsZeroWarnings) { - const SpvCompilationResult compilation_result = - compiler_.CompileGlslToSpv(kMinimalShader, strlen(kMinimalShader), - shaderc_glsl_vertex_shader, "shader"); - EXPECT_TRUE(CompilationResultIsSuccess(compilation_result)); - EXPECT_EQ(0u, compilation_result.GetNumErrors()); - EXPECT_EQ(0u, compilation_result.GetNumWarnings()); -} - -TEST_F(CppInterface, ErrorTypeUnknownShaderStage) { - // The shader kind/stage can not be determined, the error type field should - // indicate the error type is shaderc_shader_kind_error. - const SpvCompilationResult compilation_result = - compiler_.CompileGlslToSpv(kMinimalShader, strlen(kMinimalShader), - shaderc_glsl_infer_from_source, "shader"); - EXPECT_EQ(shaderc_compilation_status_invalid_stage, - compilation_result.GetCompilationStatus()); -} - -TEST_F(CppInterface, ErrorTypeCompilationError) { - // The shader kind is valid, the result object's error type field should - // indicate this compilaion fails due to compilation errors. - const SpvCompilationResult compilation_result = compiler_.CompileGlslToSpv( - kTwoErrorsShader, shaderc_glsl_vertex_shader, "shader"); - EXPECT_EQ(shaderc_compilation_status_compilation_error, - compilation_result.GetCompilationStatus()); -} - -TEST_F(CppInterface, ErrorTagIsInputFileName) { - std::string shader(kTwoErrorsShader); - const SpvCompilationResult compilation_result = - compiler_.CompileGlslToSpv(kTwoErrorsShader, strlen(kTwoErrorsShader), - shaderc_glsl_vertex_shader, "SampleInputFile"); - // Expects compilation failure errors. The error tag should be - // 'SampleInputFile' - EXPECT_FALSE(CompilationResultIsSuccess(compilation_result)); - EXPECT_THAT(compilation_result.GetErrorMessage(), - HasSubstr("SampleInputFile:3: error:")); -} - -TEST_F(CppInterface, PreprocessingOnlyOption) { - const PreprocessedSourceCompilationResult result = compiler_.PreprocessGlsl( - kMinimalShaderWithMacro, shaderc_glsl_vertex_shader, "shader", options_); - EXPECT_TRUE(CompilationResultIsSuccess(result)); - EXPECT_THAT(CompilerOutputAsString(result), HasSubstr("void main(){ }")); - - const std::string kMinimalShaderCloneOption = - "#version 140\n" - "#define E_CLONE_OPTION main\n" - "void E_CLONE_OPTION(){}\n"; - CompileOptions cloned_options(options_); - const PreprocessedSourceCompilationResult result_from_cloned_options = - compiler_.PreprocessGlsl(kMinimalShaderCloneOption, - shaderc_glsl_vertex_shader, "shader", - cloned_options); - EXPECT_TRUE(CompilationResultIsSuccess(result_from_cloned_options)); - EXPECT_THAT(CompilerOutputAsString(result_from_cloned_options), - HasSubstr("void main(){ }")); -} - -// A shader kind test case needs: 1) A shader text with or without #pragma -// annotation, 2) shader_kind. -struct ShaderKindTestCase { - const char* shader_; - shaderc_shader_kind shader_kind_; -}; - -// Test the shader kind deduction process. If the shader kind is one -// of the non-default ones, the compiler will just try to compile the -// source code in that specified shader kind. If the shader kind is -// shaderc_glsl_deduce_from_pragma, the compiler will determine the shader -// kind from #pragma annotation in the source code and emit error if none -// such annotation is found. When the shader kind is one of the default -// ones, the compiler will fall back to use the specified shader kind if -// and only if #pragma annoation is not found. - -// Valid shader kind settings should generate valid SPIR-V code. -using ValidShaderKind = testing::TestWithParam; - -TEST_P(ValidShaderKind, ValidSpvCode) { - const ShaderKindTestCase& test_case = GetParam(); - shaderc::Compiler compiler; - EXPECT_TRUE( - CompilesToValidSpv(compiler, test_case.shader_, test_case.shader_kind_)); -} - -INSTANTIATE_TEST_SUITE_P( - CompileStringTest, ValidShaderKind, - testing::ValuesIn(std::vector{ - // Valid default shader kinds. - {kEmpty310ESShader, shaderc_glsl_default_vertex_shader}, - {kEmpty310ESShader, shaderc_glsl_default_fragment_shader}, - {kEmpty310ESShader, shaderc_glsl_default_compute_shader}, - {kGeometryOnlyShader, shaderc_glsl_default_geometry_shader}, - {kTessControlOnlyShader, shaderc_glsl_default_tess_control_shader}, - {kTessEvaluationOnlyShader, - shaderc_glsl_default_tess_evaluation_shader}, - - // #pragma annotation overrides default shader kinds. - {kVertexOnlyShaderWithPragma, shaderc_glsl_default_compute_shader}, - {kFragmentOnlyShaderWithPragma, shaderc_glsl_default_vertex_shader}, - {kTessControlOnlyShaderWithPragma, - shaderc_glsl_default_fragment_shader}, - {kTessEvaluationOnlyShaderWithPragma, - shaderc_glsl_default_tess_control_shader}, - {kGeometryOnlyShaderWithPragma, - shaderc_glsl_default_tess_evaluation_shader}, - {kComputeOnlyShaderWithPragma, shaderc_glsl_default_geometry_shader}, - - // Specified non-default shader kind overrides #pragma annotation. - {kVertexOnlyShaderWithInvalidPragma, shaderc_glsl_vertex_shader}, - })); - -// Invalid shader kind settings should generate errors. -using InvalidShaderKind = testing::TestWithParam; - -TEST_P(InvalidShaderKind, CompilationShouldFail) { - const ShaderKindTestCase& test_case = GetParam(); - shaderc::Compiler compiler; - EXPECT_FALSE( - CompilesToValidSpv(compiler, test_case.shader_, test_case.shader_kind_)); -} - -INSTANTIATE_TEST_SUITE_P( - CompileStringTest, InvalidShaderKind, - testing::ValuesIn(std::vector{ - // Invalid default shader kind. - {kVertexOnlyShader, shaderc_glsl_default_fragment_shader}, - // Sets to deduce shader kind from #pragma, but #pragma is defined in - // the source code. - {kVertexOnlyShader, shaderc_glsl_infer_from_source}, - // Invalid #pragma cause errors, even though default shader kind is set - // to valid shader kind. - {kVertexOnlyShaderWithInvalidPragma, - shaderc_glsl_default_vertex_shader}, - })); - -// To test file inclusion, use an unordered_map as a fake file system to store -// fake files to be included. The unordered_map represents a filesystem by -// mapping filename (or path) string to the contents of that file as a string. -using FakeFS = std::unordered_map; - -// An includer test case needs: 1) A fake file system which is actually an -// unordered_map, so that we can resolve the content given a string. A valid -// fake file system must have one entry with key:'root' to specify the start -// shader file for compilation. 2) An string that we expect to see in the -// compilation output. -class IncluderTestCase { - public: - IncluderTestCase(FakeFS fake_fs, std::string expected_substring) - : fake_fs_(fake_fs), expected_substring_(expected_substring) { - assert(fake_fs_.find("root") != fake_fs_.end() && - "Valid fake file system needs a 'root' file\n"); - } - - const FakeFS& fake_fs() const { return fake_fs_; } - const std::string& expected_substring() const { return expected_substring_; } - - private: - FakeFS fake_fs_; - std::string expected_substring_; -}; - -// A mock class that simulates an includer. This class implements -// IncluderInterface to provide GetInclude() and ReleaseInclude() methods. -class TestIncluder : public shaderc::CompileOptions::IncluderInterface { - public: - explicit TestIncluder(const FakeFS& fake_fs) - : fake_fs_(fake_fs), responses_({}) {} - - // Get path and content from the fake file system. - shaderc_include_result* GetInclude(const char* requested_source, - shaderc_include_type type, - const char* requesting_source, - size_t include_depth) override { - responses_.emplace_back(shaderc_include_result{ - requested_source, strlen(requested_source), - fake_fs_.at(std::string(requested_source)).c_str(), - fake_fs_.at(std::string(requested_source)).size()}); - return &responses_.back(); - } - - // Response data is owned as private property, no need to release explicitly. - void ReleaseInclude(shaderc_include_result*) override {} - - private: - const FakeFS& fake_fs_; - std::vector responses_; -}; - -using IncluderTests = testing::TestWithParam; - -// Parameterized tests for includer. -TEST_P(IncluderTests, SetIncluder) { - const IncluderTestCase& test_case = GetParam(); - const FakeFS& fs = test_case.fake_fs(); - const std::string& shader = fs.at("root"); - shaderc::Compiler compiler; - CompileOptions options; - options.SetIncluder(std::unique_ptr(new TestIncluder(fs))); - const auto compilation_result = compiler.PreprocessGlsl( - shader.c_str(), shaderc_glsl_vertex_shader, "shader", options); - // Checks the existence of the expected string. - EXPECT_THAT(CompilerOutputAsString(compilation_result), - HasSubstr(test_case.expected_substring())); -} - -TEST_P(IncluderTests, SetIncluderClonedOptions) { - const IncluderTestCase& test_case = GetParam(); - const FakeFS& fs = test_case.fake_fs(); - const std::string& shader = fs.at("root"); - shaderc::Compiler compiler; - CompileOptions options; - options.SetIncluder(std::unique_ptr(new TestIncluder(fs))); - - // Cloned options should have all the settings. - CompileOptions cloned_options(options); - const auto compilation_result = compiler.PreprocessGlsl( - shader.c_str(), shaderc_glsl_vertex_shader, "shader", cloned_options); - // Checks the existence of the expected string. - EXPECT_THAT(CompilerOutputAsString(compilation_result), - HasSubstr(test_case.expected_substring())); -} - -INSTANTIATE_TEST_SUITE_P(CppInterface, IncluderTests, - testing::ValuesIn(std::vector{ - IncluderTestCase( - // Fake file system. - { - {"root", - "#version 150\n" - "void foo() {}\n" - "#include \"path/to/file_1\"\n"}, - {"path/to/file_1", "content of file_1\n"}, - }, - // Expected output. - "#line 0 \"path/to/file_1\"\n" - " content of file_1\n" - "#line 3"), - IncluderTestCase( - // Fake file system. - {{"root", - "#version 150\n" - "void foo() {}\n" - "#include \"path/to/file_1\"\n"}, - {"path/to/file_1", - "#include \"path/to/file_2\"\n" - "content of file_1\n"}, - {"path/to/file_2", "content of file_2\n"}}, - // Expected output. - "#line 0 \"path/to/file_1\"\n" - "#line 0 \"path/to/file_2\"\n" - " content of file_2\n" - "#line 1 \"path/to/file_1\"\n" - " content of file_1\n" - "#line 3"), - - })); - -TEST_F(CppInterface, WarningsOnLine) { - // By default the compiler will emit a warning on line 2 complaining - // that 'float' is a deprecated attribute in version 130. - EXPECT_THAT( - CompilationWarnings(kDeprecatedAttributeShader, - shaderc_glsl_vertex_shader, CompileOptions()), - HasSubstr(":2: warning: attribute deprecated in version 130; may be " - "removed in future release\n")); -} - -TEST_F(CppInterface, SuppressWarningsOnLine) { - // Sets the compiler to suppress warnings, so that the deprecated attribute - // warning won't be emitted. - options_.SetSuppressWarnings(); - EXPECT_EQ("", CompilationWarnings(kDeprecatedAttributeShader, - shaderc_glsl_vertex_shader, options_)); -} - -TEST_F(CppInterface, SuppressWarningsOnLineClonedOptions) { - // Sets the compiler to suppress warnings, so that the deprecated attribute - // warning won't be emitted, and the mode should be carried into any clone of - // the original option object. - options_.SetSuppressWarnings(); - CompileOptions cloned_options(options_); - EXPECT_EQ("", - CompilationWarnings(kDeprecatedAttributeShader, - shaderc_glsl_vertex_shader, cloned_options)); -} - -TEST_F(CppInterface, WarningsOnLineAsErrors) { - // Sets the compiler to make warnings into errors. So that the deprecated - // attribute warning will be emitted as an error and compilation should fail. - options_.SetWarningsAsErrors(); - EXPECT_THAT( - CompilationErrors(kDeprecatedAttributeShader, shaderc_glsl_vertex_shader, - options_), - HasSubstr(":2: error: attribute deprecated in version 130; may be " - "removed in future release\n")); -} - -TEST_F(CppInterface, WarningsOnLineAsErrorsClonedOptions) { - // Sets the compiler to make warnings into errors. So that the deprecated - // attribute warning will be emitted as an error and compilation should fail. - options_.SetWarningsAsErrors(); - CompileOptions cloned_options(options_); - // The error message should show an error instead of a warning. - EXPECT_THAT( - CompilationErrors(kDeprecatedAttributeShader, shaderc_glsl_vertex_shader, - cloned_options), - HasSubstr(":2: error: attribute deprecated in version 130; may be " - "removed in future release\n")); -} - -TEST_F(CppInterface, GlobalWarnings) { - // By default the compiler will emit a warning as version 550 is an unknown - // version. - options_.SetForcedVersionProfile(400, shaderc_profile_core); - EXPECT_THAT(CompilationWarnings(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, options_), - HasSubstr("(version, profile) forced to be (400, core)," - " while in source code it is (550, none)\n")); -} - -TEST_F(CppInterface, SuppressGlobalWarnings) { - // Sets the compiler to suppress warnings, so that the unknown version warning - // won't be emitted. - options_.SetSuppressWarnings(); - options_.SetForcedVersionProfile(400, shaderc_profile_core); - EXPECT_THAT(CompilationWarnings(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, options_), - Eq("")); -} - -TEST_F(CppInterface, SuppressGlobalWarningsClonedOptions) { - // Sets the compiler to suppress warnings, so that the unknown version warning - // won't be emitted, and the mode should be carried into any clone of the - // original option object. - options_.SetSuppressWarnings(); - options_.SetForcedVersionProfile(400, shaderc_profile_core); - CompileOptions cloned_options(options_); - EXPECT_THAT(CompilationWarnings(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, cloned_options), - Eq("")); -} - -TEST_F(CppInterface, GlobalWarningsAsErrors) { - // Sets the compiler to make warnings into errors. So that the unknown - // version warning will be emitted as an error and compilation should fail. - options_.SetWarningsAsErrors(); - options_.SetForcedVersionProfile(400, shaderc_profile_core); - EXPECT_THAT(CompilationErrors(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, options_), - HasSubstr("(version, profile) forced to be (400, core)," - " while in source code it is (550, none)\n")); -} - -TEST_F(CppInterface, GlobalWarningsAsErrorsClonedOptions) { - // Sets the compiler to make warnings into errors. This mode should be carried - // into any clone of the original option object. - options_.SetWarningsAsErrors(); - options_.SetForcedVersionProfile(400, shaderc_profile_core); - CompileOptions cloned_options(options_); - EXPECT_THAT(CompilationErrors(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, cloned_options), - HasSubstr("(version, profile) forced to be (400, core)," - " while in source code it is (550, none)\n")); -} - -TEST_F(CppInterface, SuppressWarningsModeFirstOverridesWarningsAsErrorsMode) { - // Sets suppress-warnings mode first, then sets warnings-as-errors mode. - // suppress-warnings mode should override warnings-as-errors mode, no - // error message should be output for this case. - options_.SetSuppressWarnings(); - options_.SetWarningsAsErrors(); - // Warnings on line should be inhibited. - EXPECT_EQ("", CompilationWarnings(kDeprecatedAttributeShader, - shaderc_glsl_vertex_shader, options_)); - - // Global warnings should be inhibited. - // However, the unknown version will cause an error. - EXPECT_THAT(CompilationErrors(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, options_), - Eq("shader: error: version not supported\n")); -} - -TEST_F(CppInterface, SuppressWarningsModeSecondOverridesWarningsAsErrorsMode) { - // Sets warnings-as-errors mode first, then sets suppress-warnings mode. - // suppress-warnings mode should override warnings-as-errors mode, no - // error message should be output for this case. - options_.SetWarningsAsErrors(); - options_.SetSuppressWarnings(); - // Warnings on line should be inhibited. - EXPECT_EQ("", CompilationWarnings(kDeprecatedAttributeShader, - shaderc_glsl_vertex_shader, options_)); - - // Global warnings should be inhibited. - // However, the unknown version will cause an error. - EXPECT_THAT(CompilationErrors(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, options_), - Eq("shader: error: version not supported\n")); -} - -TEST_F(CppInterface, TargetEnvCompileOptionsOpenGLCompatibilityShadersFail) { - // Glslang does not support SPIR-V code generation for OpenGL compatibility - // profile. - options_.SetTargetEnvironment(shaderc_target_env_opengl_compat, 0); - const std::string kGlslShader = - R"(#version 150 compatibility - uniform highp sampler2D tex; - void main() { - gl_FragColor = texture2D(tex, vec2(0.0,0.0)); - } - )"; - - const auto errors = - CompilationErrors(kGlslShader, shaderc_glsl_fragment_shader, options_); - EXPECT_EQ(errors, "error: OpenGL compatibility profile is not supported"); -} - -std::string BarrierComputeShader() { - return R"(#version 450 - void main() { barrier(); })"; -} - -std::string SubgroupBarrierComputeShader() { - return R"(#version 450 - #extension GL_KHR_shader_subgroup_basic : enable - void main() { subgroupBarrier(); })"; -} - -TEST_F(CppInterface, TargetEnvCompileOptionsVulkanEnvVulkan1_0ShaderSucceeds) { - options_.SetTargetEnvironment(shaderc_target_env_vulkan, 0); - EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), - shaderc_glsl_compute_shader, options_)); -} - -TEST_F(CppInterface, TargetEnvCompileOptionsVulkanEnvVulkan1_0ShaderFails) { - options_.SetTargetEnvironment(shaderc_target_env_vulkan, 0); - EXPECT_FALSE(CompilationSuccess(SubgroupBarrierComputeShader(), - shaderc_glsl_compute_shader, options_)); -} - -TEST_F(CppInterface, - TargetEnvCompileOptionsVulkan1_0EnvVulkan1_0ShaderSucceeds) { - options_.SetTargetEnvironment(shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), - shaderc_glsl_compute_shader, options_)); -} - -TEST_F(CppInterface, TargetEnvCompileOptionsVulkan1_0EnvVulkan1_1ShaderFails) { - options_.SetTargetEnvironment(shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - EXPECT_FALSE(CompilationSuccess(SubgroupBarrierComputeShader(), - shaderc_glsl_compute_shader, options_)); -} - -TEST_F(CppInterface, - TargetEnvCompileOptionsVulkan1_1EnvVulkan1_0ShaderSucceeds) { - options_.SetTargetEnvironment(shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), - shaderc_glsl_compute_shader, options_)); -} - -TEST_F(CppInterface, - TargetEnvCompileOptionsVulkan1_1EnvVulkan1_1ShaderSucceeds) { - options_.SetTargetEnvironment(shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - EXPECT_TRUE(CompilationSuccess(SubgroupBarrierComputeShader(), - shaderc_glsl_compute_shader, options_)); -} - -TEST_F(CppInterface, BeginAndEndOnSpvCompilationResult) { - const SpvCompilationResult compilation_result = compiler_.CompileGlslToSpv( - kMinimalShader, shaderc_glsl_vertex_shader, "shader"); - EXPECT_TRUE(IsValidSpv(compilation_result)); - // Use range-based for to exercise begin() and end(). - std::vector binary_words; - for (const auto& element : compilation_result) { - binary_words.push_back(element); - } - EXPECT_THAT(binary_words, - Eq(std::vector(compilation_result.cbegin(), - compilation_result.cend()))); -} - -TEST_F(CppInterface, BeginAndEndOnAssemblyCompilationResult) { - const AssemblyCompilationResult compilation_result = - compiler_.CompileGlslToSpvAssembly( - kMinimalShader, shaderc_glsl_vertex_shader, "shader", options_); - const std::string forced_to_be_a_string = - CompilerOutputAsString(compilation_result); - EXPECT_THAT(forced_to_be_a_string, HasSubstr("MemoryModel")); - const std::string string_via_begin_end(compilation_result.begin(), - compilation_result.end()); - EXPECT_THAT(string_via_begin_end, Eq(forced_to_be_a_string)); -} - -TEST_F(CppInterface, BeginAndEndOnPreprocessedResult) { - const PreprocessedSourceCompilationResult compilation_result = - compiler_.PreprocessGlsl(kMinimalShader, shaderc_glsl_vertex_shader, - "shader", options_); - const std::string forced_to_be_a_string = - CompilerOutputAsString(compilation_result); - EXPECT_THAT(forced_to_be_a_string, HasSubstr("void main()")); - const std::string string_via_begin_end(compilation_result.begin(), - compilation_result.end()); - EXPECT_THAT(string_via_begin_end, Eq(forced_to_be_a_string)); -} - -TEST_F(CppInterface, SourceLangGlslMinimalGlslVertexShaderSucceeds) { - options_.SetSourceLanguage(shaderc_source_language_glsl); - EXPECT_TRUE(CompilationSuccess(kVertexOnlyShader, shaderc_glsl_vertex_shader, - options_)); -} - -TEST_F(CppInterface, SourceLangGlslMinimalHlslVertexShaderFails) { - options_.SetSourceLanguage(shaderc_source_language_glsl); - EXPECT_FALSE(CompilationSuccess(kMinimalHlslShader, - shaderc_glsl_vertex_shader, options_)); -} - -TEST_F(CppInterface, SourceLangHlslMinimalGlslVertexShaderFails) { - options_.SetSourceLanguage(shaderc_source_language_hlsl); - EXPECT_FALSE(CompilationSuccess(kVertexOnlyShader, shaderc_glsl_vertex_shader, - options_)); -} - -TEST_F(CppInterface, SourceLangHlslMinimalHlslVertexShaderSucceeds) { - options_.SetSourceLanguage(shaderc_source_language_hlsl); - EXPECT_TRUE(CompilationSuccess(kMinimalHlslShader, shaderc_glsl_vertex_shader, - options_)); -} - -TEST( - EntryPointTest, - SourceLangHlslMinimalHlslVertexShaderAsConstCharPtrSucceedsWithEntryPointName) { - shaderc::Compiler compiler; - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - auto result = compiler.CompileGlslToSpv( - kMinimalHlslShader, strlen(kMinimalHlslShader), - shaderc_glsl_vertex_shader, "shader", "EntryPoint", options); - std::vector binary(result.begin(), result.end()); - std::string assembly; - spvtools::SpirvTools(SPV_ENV_UNIVERSAL_1_0).Disassemble(binary, &assembly); - EXPECT_THAT(assembly, - HasSubstr("OpEntryPoint Vertex %EntryPoint \"EntryPoint\"")) - << assembly; -} - -TEST( - EntryPointTest, - SourceLangHlslMinimalHlslVertexShaderAsStdStringSucceedsWithEntryPointName) { - shaderc::Compiler compiler; - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - std::string shader(kMinimalHlslShader); - auto result = compiler.CompileGlslToSpv(shader, shaderc_glsl_vertex_shader, - "shader", "EntryPoint", options); - std::vector binary(result.begin(), result.end()); - std::string assembly; - spvtools::SpirvTools(SPV_ENV_UNIVERSAL_1_0).Disassemble(binary, &assembly); - EXPECT_THAT(assembly, - HasSubstr("OpEntryPoint Vertex %EntryPoint \"EntryPoint\"")) - << assembly; -} - -TEST( - EntryPointTest, - SourceLangHlslMinimalHlslVertexShaderAsConstCharPtrSucceedsToAssemblyWithEntryPointName) { - shaderc::Compiler compiler; - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - auto assembly = compiler.CompileGlslToSpvAssembly( - kMinimalHlslShader, strlen(kMinimalHlslShader), - shaderc_glsl_vertex_shader, "shader", "EntryPoint", options); - EXPECT_THAT(std::string(assembly.begin(), assembly.end()), - HasSubstr("OpEntryPoint Vertex %EntryPoint \"EntryPoint\"")); -} - -TEST( - EntryPointTest, - SourceLangHlslMinimalHlslVertexShaderAsStdStringSucceedsToAssemblyWithEntryPointName) { - shaderc::Compiler compiler; - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - std::string shader(kMinimalHlslShader); - auto assembly = compiler.CompileGlslToSpvAssembly( - shader, shaderc_glsl_vertex_shader, "shader", "EntryPoint", options); - EXPECT_THAT(std::string(assembly.begin(), assembly.end()), - HasSubstr("OpEntryPoint Vertex %EntryPoint \"EntryPoint\"")); -} - -// Returns a fragment shader accessing a texture with the given -// offset. -std::string ShaderWithTexOffset(int offset) { - std::ostringstream oss; - oss << "#version 450\n" - "layout (binding=0) uniform sampler1D tex;\n" - "void main() { vec4 x = textureOffset(tex, 1.0, " - << offset << "); }\n"; - return oss.str(); -} - -// Ensure compilation is sensitive to limit setting. Sample just -// two particular limits. -TEST_F(CppInterface, LimitsTexelOffsetDefault) { - EXPECT_FALSE(CompilationSuccess(ShaderWithTexOffset(-9).c_str(), - shaderc_glsl_fragment_shader, options_)); - EXPECT_TRUE(CompilationSuccess(ShaderWithTexOffset(-8).c_str(), - shaderc_glsl_fragment_shader, options_)); - EXPECT_TRUE(CompilationSuccess(ShaderWithTexOffset(7).c_str(), - shaderc_glsl_fragment_shader, options_)); - EXPECT_FALSE(CompilationSuccess(ShaderWithTexOffset(8).c_str(), - shaderc_glsl_fragment_shader, options_)); -} - -TEST_F(CppInterface, LimitsTexelOffsetLowerMinimum) { - options_.SetLimit(shaderc_limit_min_program_texel_offset, -99); - EXPECT_FALSE(CompilationSuccess(ShaderWithTexOffset(-100).c_str(), - shaderc_glsl_fragment_shader, options_)); - EXPECT_TRUE(CompilationSuccess(ShaderWithTexOffset(-99).c_str(), - shaderc_glsl_fragment_shader, options_)); -} - -TEST_F(CppInterface, LimitsTexelOffsetHigherMaximum) { - options_.SetLimit(shaderc_limit_max_program_texel_offset, 10); - EXPECT_TRUE(CompilationSuccess(ShaderWithTexOffset(10).c_str(), - shaderc_glsl_fragment_shader, options_)); - EXPECT_FALSE(CompilationSuccess(ShaderWithTexOffset(11).c_str(), - shaderc_glsl_fragment_shader, options_)); -} - -TEST_F(CppInterface, UniformsWithoutBindingsFailCompilation) { - CompileOptions options; - const std::string errors = CompilationErrors( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(errors, - HasSubstr("sampler/texture/image requires layout(binding=X)")); -} - -TEST_F(CppInterface, - UniformsWithoutBindingsOptionSetAutoBindingsAssignsBindings) { - CompileOptions options; - options.SetAutoBindUniforms(true); - const std::string disassembly_text = AssemblyOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 4")); -} - -TEST_F(CppInterface, SetBindingBaseForTextureAdjustsTextureBindingsOnly) { - CompileOptions options; - options.SetAutoBindUniforms(true); - options.SetBindingBase(shaderc_uniform_kind_texture, 44); - const std::string disassembly_text = AssemblyOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 44")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 3")); -} - -TEST_F(CppInterface, SetBindingBaseForSamplerAdjustsSamplerBindingsOnly) { - CompileOptions options; - options.SetAutoBindUniforms(true); - options.SetBindingBase(shaderc_uniform_kind_sampler, 44); - const std::string disassembly_text = AssemblyOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 44")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 3")); -} - -TEST_F(CppInterface, SetBindingBaseForImageAdjustsImageBindingsOnly) { - CompileOptions options; - options.SetAutoBindUniforms(true); - options.SetBindingBase(shaderc_uniform_kind_image, 44); - const std::string disassembly_text = AssemblyOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 44")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 45")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 2")); -} - -TEST_F(CppInterface, SetBindingBaseForBufferAdjustsBufferBindingsOnly) { - CompileOptions options; - options.SetAutoBindUniforms(true); - options.SetBindingBase(shaderc_uniform_kind_buffer, 44); - const std::string disassembly_text = AssemblyOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 44")); -} - -TEST_F(CppInterface, SetBindingBaseSurvivesCloning) { - CompileOptions options; - options.SetAutoBindUniforms(true); - options.SetBindingBase(shaderc_uniform_kind_texture, 40); - options.SetBindingBase(shaderc_uniform_kind_sampler, 50); - options.SetBindingBase(shaderc_uniform_kind_image, 60); - options.SetBindingBase(shaderc_uniform_kind_buffer, 70); - CompileOptions cloned_options(options); - const std::string disassembly_text = - AssemblyOutput(kShaderWithUniformsWithoutBindings, - shaderc_glsl_vertex_shader, cloned_options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 40")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 50")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 60")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 61")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 70")); -} - -TEST_F(CppInterface, GlslDefaultPackingUsed) { - CompileOptions options; - const std::string disassembly_text = AssemblyOutput( - kGlslShaderWeirdPacking, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpMemberDecorate %B 1 Offset 16")); -} - -TEST_F(CppInterface, HlslOffsetsOptionDisableRespected) { - CompileOptions options; - options.SetHlslOffsets(false); - const std::string disassembly_text = AssemblyOutput( - kGlslShaderWeirdPacking, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpMemberDecorate %B 1 Offset 16")); -} - -TEST_F(CppInterface, HlslOffsetsOptionEnableRespected) { - CompileOptions options; - options.SetHlslOffsets(true); - const std::string disassembly_text = AssemblyOutput( - kGlslShaderWeirdPacking, shaderc_glsl_vertex_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpMemberDecorate %B 1 Offset 4")); -} - -TEST_F(CppInterface, HlslRegSetBindingForFragmentRespected) { - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - options.SetHlslRegisterSetAndBindingForStage(shaderc_fragment_shader, "t4", - "9", "16"); - const std::string disassembly_text = AssemblyOutput( - kHlslFragShaderWithRegisters, shaderc_glsl_fragment_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %t4 DescriptorSet 9")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %t4 Binding 16")); -} - -TEST_F(CppInterface, HlslRegSetBindingForDifferentStageIgnored) { - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - options.SetHlslRegisterSetAndBindingForStage(shaderc_vertex_shader, "t4", "9", - "16"); - const std::string disassembly_text = AssemblyOutput( - kHlslFragShaderWithRegisters, shaderc_glsl_fragment_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %t4 DescriptorSet 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %t4 Binding 4")); -} - -TEST_F(CppInterface, HlslRegSetBindingForAllStagesRespected) { - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - options.SetHlslRegisterSetAndBinding("t4", "9", "16"); - const std::string disassembly_text = AssemblyOutput( - kHlslFragShaderWithRegisters, shaderc_glsl_fragment_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %t4 DescriptorSet 9")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %t4 Binding 16")); -} - -TEST_F(CppInterface, HlslFunctionality1OffByDefault) { - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - // The counter needs a binding, and there is no way to set it in the shader - // source. - options.SetAutoBindUniforms(true); - const std::string disassembly_text = AssemblyOutput( - kHlslShaderWithCounterBuffer, shaderc_glsl_fragment_shader, options); - EXPECT_THAT(disassembly_text, Not(HasSubstr("OpDecorateString"))); -} - -TEST_F(CppInterface, HlslFunctionality1Respected) { - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - // The counter needs a binding, and there is no way to set it in the shader - // source. https://github.com/KhronosGroup/glslang/issues/1616 - options.SetAutoBindUniforms(true); - options.SetHlslFunctionality1(true); - const std::string disassembly_text = AssemblyOutput( - kHlslShaderWithCounterBuffer, shaderc_glsl_fragment_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorateString")); -} - -TEST_F(CppInterface, HlslFunctionality1SurvivesCloning) { - CompileOptions options; - options.SetSourceLanguage(shaderc_source_language_hlsl); - options.SetHlslFunctionality1(true); - // The counter needs a binding, and there is no way to set it in the shader - // source. https://github.com/KhronosGroup/glslang/issues/1616 - options.SetAutoBindUniforms(true); - CompileOptions cloned_options(options); - const std::string disassembly_text = AssemblyOutput( - kHlslShaderWithCounterBuffer, shaderc_glsl_fragment_shader, cloned_options); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorateString")); -} - -TEST_F(CppInterface, NanClampDefaultsOff) { - CompileOptions options; - const std::string disassembly_text = AssemblyOutput( - kGlslShaderWithClamp, shaderc_glsl_fragment_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpExtInst %v4float %1 FClamp")); -} - -TEST_F(CppInterface, NanClampMapsClampToNClamp) { - CompileOptions options; - options.SetNanClamp(true); - const std::string disassembly_text = AssemblyOutput( - kGlslShaderWithClamp, shaderc_glsl_fragment_shader, options); - EXPECT_THAT(disassembly_text, HasSubstr("OpExtInst %v4float %1 NClamp")); -} - -TEST_F(CppInterface, NanClampSurvivesCloning) { - CompileOptions options; - options.SetNanClamp(true); - CompileOptions cloned_options(options); - const std::string disassembly_text = AssemblyOutput( - kGlslShaderWithClamp, shaderc_glsl_fragment_shader, cloned_options); - EXPECT_THAT(disassembly_text, HasSubstr("OpExtInst %v4float %1 NClamp")); -} - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc/src/shaderc_private.h b/lib/shaderc/libshaderc/src/shaderc_private.h deleted file mode 100644 index ff35020d5..000000000 --- a/lib/shaderc/libshaderc/src/shaderc_private.h +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_SRC_SHADERC_PRIVATE_H_ -#define LIBSHADERC_SRC_SHADERC_PRIVATE_H_ - -#include -#include -#include -#include - -#include "shaderc/shaderc.h" - -#include "libshaderc_util/compiler.h" -#include "spirv-tools/libspirv.h" - -// Described in shaderc.h. -struct shaderc_compilation_result { - virtual ~shaderc_compilation_result() {} - - // Returns the data from this compilation as a sequence of bytes. - virtual const char* GetBytes() const = 0; - - // The size of the output data in term of bytes. - size_t output_data_size = 0; - // Compilation messages. - std::string messages; - // Number of errors. - size_t num_errors = 0; - // Number of warnings. - size_t num_warnings = 0; - // Compilation status. - shaderc_compilation_status compilation_status = - shaderc_compilation_status_null_result_object; -}; - -// Compilation result class using a vector for holding the compilation -// output data. -class shaderc_compilation_result_vector : public shaderc_compilation_result { - public: - ~shaderc_compilation_result_vector() = default; - - void SetOutputData(std::vector&& data) { - output_data_ = std::move(data); - } - - const char* GetBytes() const override { - return reinterpret_cast(output_data_.data()); - } - - private: - // Compilation output data. In normal compilation mode, it contains the - // compiled SPIR-V binary code. In disassembly and preprocessing-only mode, it - // contains a null-terminated string which is the text output. For text - // output, extra bytes with value 0x00 might be appended to complete the last - // uint32_t element. - std::vector output_data_; -}; - -// Compilation result class using a spv_binary for holding the compilation -// output data. -class shaderc_compilation_result_spv_binary - : public shaderc_compilation_result { - public: - ~shaderc_compilation_result_spv_binary() { spvBinaryDestroy(output_data_); } - - void SetOutputData(spv_binary data) { output_data_ = data; } - - const char* GetBytes() const override { - return reinterpret_cast(output_data_->code); - } - - private: - spv_binary output_data_ = nullptr; -}; - -namespace shaderc_util { -class GlslangInitializer; -} - -struct shaderc_compiler { - std::unique_ptr initializer; -}; - -// Converts a shader stage from shaderc_shader_kind into a shaderc_util::Compiler::Stage. -// This is only valid for a specifically named shader stage, e.g. vertex through fragment, -// or compute. -inline shaderc_util::Compiler::Stage shaderc_convert_specific_stage( - shaderc_shader_kind kind) { - switch (kind) { - case shaderc_vertex_shader: - return shaderc_util::Compiler::Stage::Vertex; - case shaderc_fragment_shader: - return shaderc_util::Compiler::Stage::Fragment; - case shaderc_tess_control_shader: - return shaderc_util::Compiler::Stage::TessControl; - case shaderc_tess_evaluation_shader: - return shaderc_util::Compiler::Stage::TessEval; - case shaderc_geometry_shader: - return shaderc_util::Compiler::Stage::Geometry; - case shaderc_compute_shader: - return shaderc_util::Compiler::Stage::Compute; - case shaderc_raygen_shader: - return shaderc_util::Compiler::Stage::RayGenNV; - case shaderc_intersection_shader: - return shaderc_util::Compiler::Stage::IntersectNV; - case shaderc_anyhit_shader: - return shaderc_util::Compiler::Stage::AnyHitNV; - case shaderc_closesthit_shader: - return shaderc_util::Compiler::Stage::ClosestHitNV; - case shaderc_miss_shader: - return shaderc_util::Compiler::Stage::MissNV; - case shaderc_callable_shader: - return shaderc_util::Compiler::Stage::CallableNV; - case shaderc_task_shader: - return shaderc_util::Compiler::Stage::TaskNV; - case shaderc_mesh_shader: - return shaderc_util::Compiler::Stage::MeshNV; - default: - // We don't care about the other kinds. - break; - } - // This should not occur. - assert(false && "Should have specified a specific stage"); - return shaderc_util::Compiler::Stage::TessEval; -} - -#endif // LIBSHADERC_SRC_SHADERC_PRIVATE_H_ diff --git a/lib/shaderc/libshaderc/src/shaderc_private_test.cc b/lib/shaderc/libshaderc/src/shaderc_private_test.cc deleted file mode 100644 index 72a7577fc..000000000 --- a/lib/shaderc/libshaderc/src/shaderc_private_test.cc +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2017 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "shaderc_private.h" - -namespace { - -TEST(ConvertSpecificStage, Exhaustive) { - EXPECT_EQ(shaderc_util::Compiler::Stage::Vertex, - shaderc_convert_specific_stage(shaderc_vertex_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::Fragment, - shaderc_convert_specific_stage(shaderc_fragment_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::TessControl, - shaderc_convert_specific_stage(shaderc_tess_control_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::TessEval, - shaderc_convert_specific_stage(shaderc_tess_evaluation_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::Geometry, - shaderc_convert_specific_stage(shaderc_geometry_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::Compute, - shaderc_convert_specific_stage(shaderc_compute_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::RayGenNV, - shaderc_convert_specific_stage(shaderc_raygen_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::AnyHitNV, - shaderc_convert_specific_stage(shaderc_anyhit_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::ClosestHitNV, - shaderc_convert_specific_stage(shaderc_closesthit_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::IntersectNV, - shaderc_convert_specific_stage(shaderc_intersection_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::MissNV, - shaderc_convert_specific_stage(shaderc_miss_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::CallableNV, - shaderc_convert_specific_stage(shaderc_callable_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::TaskNV, - shaderc_convert_specific_stage(shaderc_task_shader)); - EXPECT_EQ(shaderc_util::Compiler::Stage::MeshNV, - shaderc_convert_specific_stage(shaderc_mesh_shader)); -} -} // anonymous namespace diff --git a/lib/shaderc/libshaderc/src/shaderc_test.cc b/lib/shaderc/libshaderc/src/shaderc_test.cc deleted file mode 100644 index aba95d17f..000000000 --- a/lib/shaderc/libshaderc/src/shaderc_test.cc +++ /dev/null @@ -1,1878 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "shaderc/shaderc.h" - -#include -#include - -#include -#include -#include - -#include "common_shaders_for_test.h" -#include "spirv/unified1/spirv.hpp" - -namespace { - -using testing::Each; -using testing::HasSubstr; -using testing::Not; - -TEST(Init, MultipleCalls) { - shaderc_compiler_t compiler1, compiler2, compiler3; - EXPECT_NE(nullptr, compiler1 = shaderc_compiler_initialize()); - EXPECT_NE(nullptr, compiler2 = shaderc_compiler_initialize()); - EXPECT_NE(nullptr, compiler3 = shaderc_compiler_initialize()); - shaderc_compiler_release(compiler1); - shaderc_compiler_release(compiler2); - shaderc_compiler_release(compiler3); -} - -#ifndef SHADERC_DISABLE_THREADED_TESTS -TEST(Init, MultipleThreadsCalling) { - shaderc_compiler_t compiler1, compiler2, compiler3; - std::thread t1([&compiler1]() { compiler1 = shaderc_compiler_initialize(); }); - std::thread t2([&compiler2]() { compiler2 = shaderc_compiler_initialize(); }); - std::thread t3([&compiler3]() { compiler3 = shaderc_compiler_initialize(); }); - t1.join(); - t2.join(); - t3.join(); - EXPECT_NE(nullptr, compiler1); - EXPECT_NE(nullptr, compiler2); - EXPECT_NE(nullptr, compiler3); - shaderc_compiler_release(compiler1); - shaderc_compiler_release(compiler2); - shaderc_compiler_release(compiler3); -} -#endif - -TEST(Init, SPVVersion) { - unsigned int version = 0; - unsigned int revision = 0; - shaderc_get_spv_version(&version, &revision); - EXPECT_EQ(spv::Version, version); - EXPECT_EQ(spv::Revision, revision); -} - -// Determines the kind of output required from the compiler. -enum class OutputType { - SpirvBinary, - SpirvAssemblyText, - PreprocessedText, -}; - -// Generate a compilation result object with the given compile, -// shader source, shader kind, input file name, entry point name, options, -// and for the specified output type. The entry point name is only significant -// for HLSL compilation. -shaderc_compilation_result_t MakeCompilationResult( - const shaderc_compiler_t compiler, const std::string& shader, - shaderc_shader_kind kind, const char* input_file_name, - const char* entry_point_name, const shaderc_compile_options_t options, - OutputType output_type) { - switch (output_type) { - case OutputType::SpirvBinary: - return shaderc_compile_into_spv(compiler, shader.c_str(), shader.size(), - kind, input_file_name, entry_point_name, - options); - break; - case OutputType::SpirvAssemblyText: - return shaderc_compile_into_spv_assembly( - compiler, shader.c_str(), shader.size(), kind, input_file_name, - entry_point_name, options); - break; - case OutputType::PreprocessedText: - return shaderc_compile_into_preprocessed_text( - compiler, shader.c_str(), shader.size(), kind, input_file_name, - entry_point_name, options); - break; - } - // We shouldn't reach here. But some compilers might not know that. - // Be a little defensive and produce something. - return shaderc_compile_into_spv(compiler, shader.c_str(), shader.size(), kind, - input_file_name, entry_point_name, options); -} - -// RAII class for shaderc_compilation_result. Used for shader compilation. -class Compilation { - public: - // Compiles shader and keeps the result. - Compilation(const shaderc_compiler_t compiler, const std::string& shader, - shaderc_shader_kind kind, const char* input_file_name, - const char* entry_point_name, - const shaderc_compile_options_t options = nullptr, - OutputType output_type = OutputType::SpirvBinary) - : compiled_result_( - MakeCompilationResult(compiler, shader, kind, input_file_name, - entry_point_name, options, output_type)) {} - - ~Compilation() { shaderc_result_release(compiled_result_); } - - shaderc_compilation_result_t result() const { return compiled_result_; } - - private: - shaderc_compilation_result_t compiled_result_; -}; - -// RAII class for shaderc_compilation_result. Used for shader assembling. -class Assembling { - public: - // Assembles shader and keeps the result. - Assembling(const shaderc_compiler_t compiler, const std::string& assembly, - const shaderc_compile_options_t options = nullptr) - : compiled_result_(shaderc_assemble_into_spv(compiler, assembly.data(), - assembly.size(), options)) {} - - ~Assembling() { shaderc_result_release(compiled_result_); } - - shaderc_compilation_result_t result() const { return compiled_result_; } - - private: - shaderc_compilation_result_t compiled_result_; -}; - -struct CleanupOptions { - void operator()(shaderc_compile_options_t options) const { - shaderc_compile_options_release(options); - } -}; - -typedef std::unique_ptr - compile_options_ptr; - -// RAII class for shaderc_compiler_t -class Compiler { - public: - Compiler() { compiler = shaderc_compiler_initialize(); } - ~Compiler() { shaderc_compiler_release(compiler); } - shaderc_compiler_t get_compiler_handle() { return compiler; } - - private: - shaderc_compiler_t compiler; -}; - -// RAII class for shader_compiler_options_t -class Options { - public: - Options() : options_(shaderc_compile_options_initialize()) {} - ~Options() { shaderc_compile_options_release(options_); } - shaderc_compile_options_t get() { return options_; } - - private: - shaderc_compile_options_t options_; -}; - -// Helper function to check if the compilation result indicates a successful -// compilation. -bool CompilationResultIsSuccess(const shaderc_compilation_result_t result) { - return shaderc_result_get_compilation_status(result) == - shaderc_compilation_status_success; -} - -// Returns true if the given result contains a SPIR-V module that contains -// at least the number of bytes of the header and the correct magic number. -bool ResultContainsValidSpv(shaderc_compilation_result_t result) { - if (!CompilationResultIsSuccess(result)) return false; - size_t length = shaderc_result_get_length(result); - if (length < 20) return false; - const uint32_t* bytes = static_cast( - static_cast(shaderc_result_get_bytes(result))); - return bytes[0] == spv::MagicNumber; -} - -// Compiles a shader and returns true if the result is valid SPIR-V. -bool CompilesToValidSpv(Compiler& compiler, const std::string& shader, - shaderc_shader_kind kind, - const shaderc_compile_options_t options = nullptr) { - const Compilation comp(compiler.get_compiler_handle(), shader, kind, "shader", - "main", options, OutputType::SpirvBinary); - return ResultContainsValidSpv(comp.result()); -} - -// A testing class to test the compilation of a string with or without options. -// This class wraps the initailization of compiler and compiler options and -// groups the result checking methods. Subclass tests can access the compiler -// object and compiler option object to set their properties. Input file names -// are set to "shader". -class CompileStringTest : public testing::Test { - protected: - // Compiles a shader and returns true on success, false on failure. - bool CompilationSuccess(const std::string& shader, shaderc_shader_kind kind, - shaderc_compile_options_t options = nullptr, - OutputType output_type = OutputType::SpirvBinary) { - return CompilationResultIsSuccess( - Compilation(compiler_.get_compiler_handle(), shader, kind, "shader", - "main", options, output_type) - .result()); - } - - // Compiles a shader, expects compilation success, and returns the warning - // messages. - const std::string CompilationWarnings( - const std::string& shader, shaderc_shader_kind kind, - const shaderc_compile_options_t options = nullptr, - OutputType output_type = OutputType::SpirvBinary) { - const Compilation comp(compiler_.get_compiler_handle(), shader, kind, - "shader", "main", options, output_type); - EXPECT_TRUE(CompilationResultIsSuccess(comp.result())) << kind << '\n' - << shader; - return shaderc_result_get_error_message(comp.result()); - } - - // Compiles a shader, expects compilation failure, and returns the messages. - const std::string CompilationErrors( - const std::string& shader, shaderc_shader_kind kind, - const shaderc_compile_options_t options = nullptr, - OutputType output_type = OutputType::SpirvBinary, - const char* source_name = "shader") { - const Compilation comp(compiler_.get_compiler_handle(), shader, kind, - source_name, "main", options, output_type); - EXPECT_FALSE(CompilationResultIsSuccess(comp.result())) << kind << '\n' - << shader; - EXPECT_EQ(0u, shaderc_result_get_length(comp.result())); - return shaderc_result_get_error_message(comp.result()); - } - - // Compiles a shader and returns the messages. - const std::string CompilationMessages( - const std::string& shader, shaderc_shader_kind kind, - const shaderc_compile_options_t options = nullptr, - OutputType output_type = OutputType::SpirvBinary) { - const Compilation comp(compiler_.get_compiler_handle(), shader, kind, - "shader", "main", options, output_type); - return shaderc_result_get_error_message(comp.result()); - } - - // Compiles a shader, expects compilation success, and returns the output - // bytes. - const std::string CompilationOutput( - const std::string& shader, shaderc_shader_kind kind, - const shaderc_compile_options_t options = nullptr, - OutputType output_type = OutputType::SpirvBinary) { - const Compilation comp(compiler_.get_compiler_handle(), shader, kind, - "shader", "main", options, output_type); - EXPECT_TRUE(CompilationResultIsSuccess(comp.result())) - << "shader kind: " << kind << "\nerror message: " - << shaderc_result_get_error_message(comp.result()) - << "\nshader source code: \n" - << shader; - // Use string(const char* s, size_t n) constructor instead of - // string(const char* s) to make sure the string has complete binary data. - // string(const char* s) assumes a null-terminated C-string, which will cut - // the binary data when it sees a '\0' byte. - return std::string(shaderc_result_get_bytes(comp.result()), - shaderc_result_get_length(comp.result())); - } - - Compiler compiler_; - compile_options_ptr options_; - - public: - CompileStringTest() : options_(shaderc_compile_options_initialize()) {} -}; - -// A testing class to test the assembling of a string. -// This class wraps the initailization of compiler and groups the result -// checking methods. Subclass tests can access the compiler object to set their -// properties. -class AssembleStringTest : public testing::Test { - public: - AssembleStringTest() : options_(shaderc_compile_options_initialize()) {} - ~AssembleStringTest() { shaderc_compile_options_release(options_); } - - protected: - // Assembles the given assembly and returns true on success. - bool AssemblingSuccess(const std::string& assembly) { - return CompilationResultIsSuccess( - Assembling(compiler_.get_compiler_handle(), assembly, options_) - .result()); - } - - bool AssemblingValid(const std::string& assembly) { - const auto assembling = - Assembling(compiler_.get_compiler_handle(), assembly); - return ResultContainsValidSpv(assembling.result()); - } - - Compiler compiler_; - shaderc_compile_options_t options_; -}; - -// Name holders so that we have test cases being grouped with only one real -// compilation class. -using CompileStringWithOptionsTest = CompileStringTest; -using CompileKindsTest = CompileStringTest; - -TEST_F(CompileStringTest, EmptyString) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_FALSE(CompilationSuccess("", shaderc_glsl_vertex_shader)); - EXPECT_FALSE(CompilationSuccess("", shaderc_glsl_fragment_shader)); -} - -TEST_F(AssembleStringTest, EmptyString) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_TRUE(AssemblingSuccess("")); -} - -TEST_F(CompileStringTest, GarbageString) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_FALSE(CompilationSuccess("jfalkds", shaderc_glsl_vertex_shader)); - EXPECT_FALSE(CompilationSuccess("jfalkds", shaderc_glsl_fragment_shader)); -} - -TEST_F(AssembleStringTest, GarbageString) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - auto assembling = Assembling(compiler_.get_compiler_handle(), "jfalkds"); - EXPECT_FALSE(CompilationResultIsSuccess(assembling.result())); - EXPECT_EQ(1u, shaderc_result_get_num_errors(assembling.result())); - EXPECT_EQ(0u, shaderc_result_get_num_warnings(assembling.result())); -} - -// TODO(antiagainst): right now there is no assembling difference for all the -// target environments exposed by shaderc. So the following is just testing the -// target environment is accepted. -TEST_F(AssembleStringTest, AcceptTargetEnv) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_set_target_env(options_, shaderc_target_env_opengl, - /* version = */ 0); - EXPECT_TRUE(AssemblingSuccess("OpCapability Shader")); -} - -TEST_F(CompileStringTest, ReallyLongShader) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - std::string minimal_shader = ""; - minimal_shader += "#version 140\n"; - minimal_shader += "void foo(){}"; - minimal_shader.append(1024 * 1024 * 8, ' '); // 8MB of spaces. - minimal_shader += "void main(){}"; - EXPECT_TRUE(CompilesToValidSpv(compiler_, minimal_shader, - shaderc_glsl_vertex_shader)); - EXPECT_TRUE(CompilesToValidSpv(compiler_, minimal_shader, - shaderc_glsl_fragment_shader)); -} - -TEST_F(CompileStringTest, MinimalShader) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_vertex_shader)); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_fragment_shader)); -} - -TEST_F(AssembleStringTest, MinimalShader) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_TRUE(AssemblingValid(kMinimalShaderAssembly)); -} - -TEST_F(CompileStringTest, WorksWithCompileOptions) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F(CompileStringTest, GetNumErrors) { - Compilation comp(compiler_.get_compiler_handle(), kTwoErrorsShader, - shaderc_glsl_vertex_shader, "shader", "main"); - // Expects compilation failure and two errors. - EXPECT_FALSE(CompilationResultIsSuccess(comp.result())); - EXPECT_EQ(2u, shaderc_result_get_num_errors(comp.result())); - // Expects the number of warnings to be zero. - EXPECT_EQ(0u, shaderc_result_get_num_warnings(comp.result())); -} - -TEST_F(CompileStringTest, GetNumWarnings) { - Compilation comp(compiler_.get_compiler_handle(), kTwoWarningsShader, - shaderc_glsl_vertex_shader, "shader", "main"); - // Expects compilation success with two warnings. - EXPECT_TRUE(CompilationResultIsSuccess(comp.result())); - EXPECT_EQ(2u, shaderc_result_get_num_warnings(comp.result())); - // Expects the number of errors to be zero. - EXPECT_EQ(0u, shaderc_result_get_num_errors(comp.result())); -} - -TEST_F(CompileStringTest, ZeroErrorsZeroWarnings) { - Compilation comp(compiler_.get_compiler_handle(), kMinimalShader, - shaderc_glsl_vertex_shader, "shader", "main"); - // Expects compilation success with zero warnings. - EXPECT_TRUE(CompilationResultIsSuccess(comp.result())); - EXPECT_EQ(0u, shaderc_result_get_num_warnings(comp.result())); - // Expects the number of errors to be zero. - EXPECT_EQ(0u, shaderc_result_get_num_errors(comp.result())); -} - -TEST_F(CompileStringTest, ErrorTypeUnknownShaderStage) { - // The shader kind/stage can not be determined, the error type field should - // indicate the error type is shaderc_shader_kind_error. - Compilation comp(compiler_.get_compiler_handle(), kMinimalShader, - shaderc_glsl_infer_from_source, "shader", "main"); - EXPECT_EQ(shaderc_compilation_status_invalid_stage, - shaderc_result_get_compilation_status(comp.result())); -} -TEST_F(CompileStringTest, ErrorTypeCompilationError) { - // The shader kind is valid, the result object's error type field should - // indicate this compilaion fails due to compilation errors. - Compilation comp(compiler_.get_compiler_handle(), kTwoErrorsShader, - shaderc_glsl_vertex_shader, "shader", "main"); - EXPECT_EQ(shaderc_compilation_status_compilation_error, - shaderc_result_get_compilation_status(comp.result())); -} - -TEST_F(CompileStringWithOptionsTest, CloneCompilerOptions) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - compile_options_ptr options_(shaderc_compile_options_initialize()); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_vertex_shader, options_.get())); - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalShader, - shaderc_glsl_vertex_shader, - cloned_options.get())); -} - -TEST_F(CompileStringWithOptionsTest, MacroCompileOptions) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_add_macro_definition(options_.get(), "E", 1u, "main", - 4u); - const std::string kMinimalExpandedShader = "#version 140\nvoid E(){}"; - const std::string kMinimalDoubleExpandedShader = "#version 140\nF E(){}"; - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalExpandedShader, - shaderc_glsl_vertex_shader, options_.get())); - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - // The simplest should still compile with the cloned options. - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalExpandedShader, - shaderc_glsl_vertex_shader, - cloned_options.get())); - EXPECT_FALSE(CompilesToValidSpv(compiler_, kMinimalDoubleExpandedShader, - shaderc_glsl_vertex_shader, - cloned_options.get())); - - shaderc_compile_options_add_macro_definition(cloned_options.get(), "F", 1u, - "void", 4u); - // This should still not work with the original options. - EXPECT_FALSE(CompilesToValidSpv(compiler_, kMinimalDoubleExpandedShader, - shaderc_glsl_vertex_shader, options_.get())); - // This should work with the cloned options that have the additional - // parameter. - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalDoubleExpandedShader, - shaderc_glsl_vertex_shader, - cloned_options.get())); -} - -TEST_F(CompileStringWithOptionsTest, MacroCompileOptionsNotNullTerminated) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_add_macro_definition(options_.get(), "EFGH", 1u, - "mainnnnnn", 4u); - const std::string kMinimalExpandedShader = "#version 140\nvoid E(){}"; - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalExpandedShader, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, ValuelessMacroCompileOptionsZeroLength) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_add_macro_definition(options_.get(), "E", 1u, - "somthing", 0u); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kValuelessPredefinitionShader, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, ValuelessMacroCompileOptionsNullPointer) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_add_macro_definition(options_.get(), "E", 1u, nullptr, - 100u); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kValuelessPredefinitionShader, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, DisassemblyOption) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - // This should work with both the glslang assembly format and the - // SPIR-V tools assembly format. - const std::string disassembly_text = - CompilationOutput(kMinimalShader, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("Capability Shader")); - EXPECT_THAT(disassembly_text, HasSubstr("MemoryModel")); -} - -TEST_F(CompileStringWithOptionsTest, DisassembleMinimalShader) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string disassembly_text = - CompilationOutput(kMinimalShader, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - for (const auto& substring : kMinimalShaderDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } -} - -TEST_F(CompileStringWithOptionsTest, ForcedVersionProfileCorrectStd) { - // Forces the version and profile to 450core, which fixes the missing - // #version. - shaderc_compile_options_set_forced_version_profile(options_.get(), 450, - shaderc_profile_core); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kCoreVertShaderWithoutVersion, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - ForcedVersionProfileCorrectStdClonedOptions) { - // Forces the version and profile to 450core, which fixes the missing - // #version. - shaderc_compile_options_set_forced_version_profile(options_.get(), 450, - shaderc_profile_core); - // This mode should be carried to any clone of the original options object. - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kCoreVertShaderWithoutVersion, - shaderc_glsl_vertex_shader, - cloned_options.get())); -} - -TEST_F(CompileStringWithOptionsTest, ForcedVersionProfileInvalidModule) { - // Forces the version and profile to 310es, while the source module is invalid - // for this version of GLSL. Compilation should fail. - shaderc_compile_options_set_forced_version_profile(options_.get(), 310, - shaderc_profile_es); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_THAT(CompilationErrors(kCoreVertShaderWithoutVersion, - shaderc_glsl_vertex_shader, options_.get()), - HasSubstr("error: 'gl_ClipDistance' : undeclared identifier\n")); -} - -TEST_F(CompileStringWithOptionsTest, ForcedVersionProfileConflictingStd) { - // Forces the version and profile to 450core, which is in conflict with the - // #version in shader. - shaderc_compile_options_set_forced_version_profile(options_.get(), 450, - shaderc_profile_core); - const std::string kVertexShader = - std::string("#version 310 es\n") + kCoreVertShaderWithoutVersion; - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_THAT(CompilationWarnings(kVertexShader, shaderc_glsl_vertex_shader, - options_.get()), - HasSubstr("warning: (version, profile) forced to be (450, core), " - "while in source code it is (310, es)\n")); -} - -TEST_F(CompileStringWithOptionsTest, ForcedVersionProfileUnknownVersionStd) { - // Forces the version and profile to 4242core, which is an unknown version. - shaderc_compile_options_set_forced_version_profile( - options_.get(), 4242 /*unknown version*/, shaderc_profile_core); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - // Warning message should complain about the unknown version. - // - // Also, Glslang errors out on unkown versions, due to commit: - // https://github.com/KhronosGroup/glslang/commit/9353f1afab8d1c2b1811c6acd807675128eaabc5 - const auto errs = CompilationErrors( - kMinimalShader, shaderc_glsl_vertex_shader, options_.get()); - EXPECT_THAT( - errs, HasSubstr("warning: (version, profile) forced to be (4242, core), " - "while in source code it is (140, none)\n")); - EXPECT_THAT(errs, HasSubstr("error: version not supported\n")); -} - -TEST_F(CompileStringWithOptionsTest, ForcedVersionProfileVersionsBefore150) { - // Versions before 150 do not allow a profile token, shaderc_profile_none - // should be passed down as the profile parameter. - shaderc_compile_options_set_forced_version_profile(options_.get(), 140, - shaderc_profile_none); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_TRUE(CompilationSuccess(kMinimalShaderWithoutVersion, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, ForcedVersionProfileRedundantProfileStd) { - // Forces the version and profile to 100core. But versions before 150 do not - // allow a profile token, compilation should fail. - shaderc_compile_options_set_forced_version_profile(options_.get(), 100, - shaderc_profile_core); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_THAT(CompilationErrors(kMinimalShader, shaderc_glsl_vertex_shader, - options_.get()), - HasSubstr("error: #version: versions before 150 do not allow a " - "profile token\n")); -} - -TEST_F(CompileStringWithOptionsTest, GenerateDebugInfoBinary) { - shaderc_compile_options_set_generate_debug_info(options_.get()); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, options_.get()); - // The binary output should contain the name of the vector (debug_info_sample) - // null-terminated, as well as the whole original source. - std::string vector_name("debug_info_sample"); - vector_name.resize(vector_name.size() + 1); - EXPECT_THAT(binary_output, HasSubstr(vector_name)); - EXPECT_THAT(binary_output, HasSubstr(kMinimalDebugInfoShader)); -} - -TEST_F(CompileStringWithOptionsTest, GenerateDebugInfoBinaryClonedOptions) { - shaderc_compile_options_set_generate_debug_info(options_.get()); - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, cloned_options.get()); - // The binary output should contain the name of the vector (debug_info_sample) - // null-terminated, as well as the whole original source. - std::string vector_name("debug_info_sample"); - vector_name.resize(vector_name.size() + 1); - EXPECT_THAT(binary_output, HasSubstr(vector_name)); - EXPECT_THAT(binary_output, HasSubstr(kMinimalDebugInfoShader)); -} - -TEST_F(CompileStringWithOptionsTest, GenerateDebugInfoDisassembly) { - shaderc_compile_options_set_generate_debug_info(options_.get()); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - // Generate assembly text we can compare its output as a string. - // The disassembly output should contain the name of the vector: - // debug_info_sample. - EXPECT_THAT( - CompilationOutput(kMinimalDebugInfoShader, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText), - HasSubstr("debug_info_sample")); -} - -TEST_F(CompileStringWithOptionsTest, CompileAndOptimizeWithLevelZero) { - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_zero); - const std::string disassembly_text = - CompilationOutput(kMinimalShader, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - for (const auto& substring : kMinimalShaderDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we still have debug instructions. - EXPECT_THAT(disassembly_text, HasSubstr("OpName")); - EXPECT_THAT(disassembly_text, HasSubstr("OpSource")); -} - -TEST_F(CompileStringWithOptionsTest, CompileAndOptimizeWithLevelPerformance) { - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_performance); - const std::string disassembly_text = - CompilationOutput(kGlslMultipleFnShader, shaderc_glsl_fragment_shader, - options_.get(), OutputType::SpirvAssemblyText); - // Check that we do not have function calls anymore. - EXPECT_THAT(disassembly_text, Not(HasSubstr("OpFunctionCall"))); -} - -TEST_F(CompileStringWithOptionsTest, CompileAndOptimizeWithLevelSize) { - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_size); - const std::string disassembly_text = - CompilationOutput(kMinimalShader, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - for (const auto& substring : kMinimalShaderDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we do not have debug instructions. - EXPECT_THAT(disassembly_text, Not(HasSubstr("OpName"))); - EXPECT_THAT(disassembly_text, Not(HasSubstr("OpSource"))); -} - -TEST_F(CompileStringWithOptionsTest, CompileAndOptimizeForVulkan10Failure) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_hlsl); - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_performance); - - EXPECT_FALSE(CompilesToValidSpv(compiler_, kHlslWaveActiveSumeComputeShader, - shaderc_compute_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, CompileAndOptimizeForVulkan11Success) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_hlsl); - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_performance); - - const std::string disassembly_text = CompilationOutput( - kHlslWaveActiveSumeComputeShader, shaderc_compute_shader, options_.get(), - OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpGroupNonUniformIAdd")); -} - -TEST_F(CompileStringWithOptionsTest, FollowingOptLevelOverridesPreviousOne) { - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_size); - // Optimization level settings overridden by - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_zero); - const std::string disassembly_text = - CompilationOutput(kMinimalShader, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - for (const auto& substring : kMinimalShaderDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we still have debug instructions. - EXPECT_THAT(disassembly_text, HasSubstr("OpName")); - EXPECT_THAT(disassembly_text, HasSubstr("OpSource")); -} - -TEST_F(CompileStringWithOptionsTest, - GenerateDebugInfoOverridesOptimizationLevel) { - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_size); - // Optimization level settings overridden by - shaderc_compile_options_set_generate_debug_info(options_.get()); - const std::string disassembly_text = - CompilationOutput(kMinimalShader, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - for (const auto& substring : kMinimalShaderDebugInfoDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we still have debug instructions. - EXPECT_THAT(disassembly_text, HasSubstr("OpName")); - EXPECT_THAT(disassembly_text, HasSubstr("OpSource")); -} - -TEST_F(CompileStringWithOptionsTest, - GenerateDebugInfoProhibitsOptimizationLevel) { - // Setting generate debug info first also works. - shaderc_compile_options_set_generate_debug_info(options_.get()); - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_size); - const std::string disassembly_text = - CompilationOutput(kMinimalShader, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - for (const auto& substring : kMinimalShaderDebugInfoDisassemblySubstrings) { - EXPECT_THAT(disassembly_text, HasSubstr(substring)); - } - // Check that we still have debug instructions. - EXPECT_THAT(disassembly_text, HasSubstr("OpName")); - EXPECT_THAT(disassembly_text, HasSubstr("OpSource")); -} - -TEST_F(CompileStringWithOptionsTest, PreprocessingOnlyOption) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string kMinimalShaderWithMacro = - "#version 150\n" - "#define E main\n" - "void E(){}\n"; - const std::string preprocessed_text = - CompilationOutput(kMinimalShaderWithMacro, shaderc_glsl_vertex_shader, - options_.get(), OutputType::PreprocessedText); - EXPECT_THAT(preprocessed_text, HasSubstr("void main(){ }")); - - const std::string kMinimalShaderWithMacroCloneOption = - "#version 150\n" - "#define E_CLONE_OPTION main\n" - "void E_CLONE_OPTION(){}\n"; - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - const std::string preprocessed_text_cloned_options = CompilationOutput( - kMinimalShaderWithMacroCloneOption, shaderc_glsl_vertex_shader, - options_.get(), OutputType::PreprocessedText); - EXPECT_THAT(preprocessed_text_cloned_options, HasSubstr("void main(){ }")); -} - -// A shader kind test cases needs: 1) A shader text with or without #pragma -// annotation, 2) shader_kind. -struct ShaderKindTestCase { - const char* shader_; - shaderc_shader_kind shader_kind_; -}; - -// Test the shader kind deduction process. If the shader kind is one of the -// forced ones, the compiler will just try to compile the source code in that -// specified shader kind. If the shader kind is shaderc_glsl_deduce_from_pragma, -// the compiler will determine the shader kind from #pragma annotation in the -// source code and emit error if none such annotation is found. When the shader -// kind is one of the default ones, the compiler will fall back to use the -// specified shader kind if and only if #pragma annoation is not found. - -// Valid shader kind settings should generate valid SPIR-V code. -using ValidShaderKind = testing::TestWithParam; - -TEST_P(ValidShaderKind, ValidSpvCode) { - const ShaderKindTestCase& test_case = GetParam(); - Compiler compiler; - EXPECT_TRUE( - CompilesToValidSpv(compiler, test_case.shader_, test_case.shader_kind_)); -} - -INSTANTIATE_TEST_SUITE_P( - CompileStringTest, ValidShaderKind, - testing::ValuesIn(std::vector{ - // Valid default shader kinds. - {kEmpty310ESShader, shaderc_glsl_default_vertex_shader}, - {kEmpty310ESShader, shaderc_glsl_default_fragment_shader}, - {kEmpty310ESShader, shaderc_glsl_default_compute_shader}, - {kGeometryOnlyShader, shaderc_glsl_default_geometry_shader}, - {kTessControlOnlyShader, shaderc_glsl_default_tess_control_shader}, - {kTessEvaluationOnlyShader, - shaderc_glsl_default_tess_evaluation_shader}, - {kNVMeshShader, shaderc_glsl_default_mesh_shader}, - {kNVTaskShader, shaderc_glsl_default_task_shader}, - - // #pragma annotation overrides default shader kinds. - {kVertexOnlyShaderWithPragma, shaderc_glsl_default_compute_shader}, - {kFragmentOnlyShaderWithPragma, shaderc_glsl_default_vertex_shader}, - {kTessControlOnlyShaderWithPragma, - shaderc_glsl_default_fragment_shader}, - {kTessEvaluationOnlyShaderWithPragma, - shaderc_glsl_default_tess_control_shader}, - {kGeometryOnlyShaderWithPragma, - shaderc_glsl_default_tess_evaluation_shader}, - {kComputeOnlyShaderWithPragma, shaderc_glsl_default_geometry_shader}, - {kNVMeshShaderWithPragma, shaderc_glsl_default_geometry_shader}, - {kNVTaskShaderWithPragma, shaderc_glsl_default_geometry_shader}, - - // Infer from source - {kVertexOnlyShaderWithPragma, shaderc_glsl_infer_from_source}, - {kNVMeshShaderWithPragma, shaderc_glsl_infer_from_source}, - {kNVTaskShaderWithPragma, shaderc_glsl_infer_from_source}, - - // Specified non-default shader kind overrides #pragma annotation. - {kVertexOnlyShaderWithInvalidPragma, shaderc_glsl_vertex_shader}, - })); - -using InvalidShaderKind = testing::TestWithParam; - -// Invalid shader kind settings should generate errors. -TEST_P(InvalidShaderKind, CompilationShouldFail) { - const ShaderKindTestCase& test_case = GetParam(); - Compiler compiler; - EXPECT_FALSE( - CompilesToValidSpv(compiler, test_case.shader_, test_case.shader_kind_)); -} - -INSTANTIATE_TEST_SUITE_P( - CompileStringTest, InvalidShaderKind, - testing::ValuesIn(std::vector{ - // Invalid default shader kind. - {kVertexOnlyShader, shaderc_glsl_default_fragment_shader}, - // Sets to deduce shader kind from #pragma, but #pragma is defined in - // the source code. - {kVertexOnlyShader, shaderc_glsl_infer_from_source}, - // Invalid #pragma cause errors, even though default shader kind is set - // to valid shader kind. - {kVertexOnlyShaderWithInvalidPragma, - shaderc_glsl_default_vertex_shader}, - })); - -// To test file inclusion, use an unordered_map as a fake file system to store -// fake files to be included. The unordered_map represents a filesystem by -// mapping filename (or path) string to the contents of that file as a string. -using FakeFS = std::unordered_map; - -// An includer test case needs: 1) A fake file system which is actually an -// unordered_map, so that we can resolve the content given a string. A valid -// fake file system must have one entry with key:'root' to specify the start -// shader file for compilation. 2) An string that we expect to see in the -// compilation output. -class IncluderTestCase { - public: - IncluderTestCase(FakeFS fake_fs, std::string expected_substring) - : fake_fs_(fake_fs), expected_substring_(expected_substring) { - assert(fake_fs_.find("root") != fake_fs_.end() && - "Valid fake file system needs a 'root' file\n"); - } - - const FakeFS& fake_fs() const { return fake_fs_; } - const std::string& expected_substring() const { return expected_substring_; } - - private: - FakeFS fake_fs_; - std::string expected_substring_; -}; - -// A mock class that simulate an includer. C API needs two function pointers -// each for get including data and release the data. This class defined two -// static functions, which wrap their matching member functions, to be passed to -// libshaderc C API. -class TestIncluder { - public: - explicit TestIncluder(const FakeFS& fake_fs) - : fake_fs_(fake_fs), responses_({}) {} - - // Get path and content from the fake file system. - shaderc_include_result* GetInclude(const char* filename) { - responses_.emplace_back(shaderc_include_result{ - filename, strlen(filename), fake_fs_.at(std::string(filename)).c_str(), - fake_fs_.at(std::string(filename)).size()}); - return &responses_.back(); - } - - // Response data is owned as private property, no need to release explicitly. - void ReleaseInclude(shaderc_include_result*) {} - - // Wrapper for the corresponding member function. - static shaderc_include_result* GetIncluderResponseWrapper( - void* user_data, const char* filename, int, const char* includer, - size_t include_depth) { - return static_cast(user_data)->GetInclude(filename); - } - - // Wrapper for the corresponding member function. - static void ReleaseIncluderResponseWrapper(void* user_data, - shaderc_include_result* data) { - return static_cast(user_data)->ReleaseInclude(data); - } - - private: - // Includer response data is stored as private property. - const FakeFS& fake_fs_; - std::vector responses_; -}; - -using IncluderTests = testing::TestWithParam; - -// Parameterized tests for includer. -TEST_P(IncluderTests, SetIncluderCallbacks) { - const IncluderTestCase& test_case = GetParam(); - const FakeFS& fs = test_case.fake_fs(); - const std::string& shader = fs.at("root"); - TestIncluder includer(fs); - Compiler compiler; - compile_options_ptr options(shaderc_compile_options_initialize()); - shaderc_compile_options_set_include_callbacks( - options.get(), TestIncluder::GetIncluderResponseWrapper, - TestIncluder::ReleaseIncluderResponseWrapper, &includer); - - const Compilation comp(compiler.get_compiler_handle(), shader, - shaderc_glsl_vertex_shader, "shader", "main", - options.get(), OutputType::PreprocessedText); - // Checks the existence of the expected string. - EXPECT_THAT(shaderc_result_get_bytes(comp.result()), - HasSubstr(test_case.expected_substring())); -} - -TEST_P(IncluderTests, SetIncluderCallbacksClonedOptions) { - const IncluderTestCase& test_case = GetParam(); - const FakeFS& fs = test_case.fake_fs(); - const std::string& shader = fs.at("root"); - TestIncluder includer(fs); - Compiler compiler; - compile_options_ptr options(shaderc_compile_options_initialize()); - shaderc_compile_options_set_include_callbacks( - options.get(), TestIncluder::GetIncluderResponseWrapper, - TestIncluder::ReleaseIncluderResponseWrapper, &includer); - - // Cloned options should have all the settings. - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options.get())); - - const Compilation comp(compiler.get_compiler_handle(), shader, - shaderc_glsl_vertex_shader, "shader", "main", - cloned_options.get(), OutputType::PreprocessedText); - // Checks the existence of the expected string. - EXPECT_THAT(shaderc_result_get_bytes(comp.result()), - HasSubstr(test_case.expected_substring())); -} - -INSTANTIATE_TEST_SUITE_P(CompileStringTest, IncluderTests, - testing::ValuesIn(std::vector{ - IncluderTestCase( - // Fake file system. - { - {"root", - "#version 150\n" - "void foo() {}\n" - "#include \"path/to/file_1\"\n"}, - {"path/to/file_1", "content of file_1\n"}, - }, - // Expected output. - "#line 0 \"path/to/file_1\"\n" - " content of file_1\n" - "#line 3"), - IncluderTestCase( - // Fake file system. - {{"root", - "#version 150\n" - "void foo() {}\n" - "#include \"path/to/file_1\"\n"}, - {"path/to/file_1", - "#include \"path/to/file_2\"\n" - "content of file_1\n"}, - {"path/to/file_2", "content of file_2\n"}}, - // Expected output. - "#line 0 \"path/to/file_1\"\n" - "#line 0 \"path/to/file_2\"\n" - " content of file_2\n" - "#line 1 \"path/to/file_1\"\n" - " content of file_1\n" - "#line 3"), - - })); - -TEST_F(CompileStringWithOptionsTest, WarningsOnLine) { - // Some versions of Glslang will return an error, some will return just - // warnings. - EXPECT_THAT( - CompilationMessages(kDeprecatedAttributeShader, - shaderc_glsl_vertex_shader, options_.get()), - HasSubstr(":2: warning: attribute deprecated in version 130; may be " - "removed in future release\n")); -} - -TEST_F(CompileStringWithOptionsTest, WarningsOnLineAsErrors) { - shaderc_compile_options_set_warnings_as_errors(options_.get()); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_THAT( - CompilationErrors(kDeprecatedAttributeShader, shaderc_glsl_vertex_shader, - options_.get()), - HasSubstr(":2: error: attribute deprecated in version 130; may be " - "removed in future release\n")); -} - -TEST_F(CompileStringWithOptionsTest, SuppressWarningsOnLine) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_set_suppress_warnings(options_.get()); - EXPECT_THAT( - CompilationMessages(kDeprecatedAttributeShader, - shaderc_glsl_vertex_shader, options_.get()), - Not(HasSubstr(":2: warning: attribute deprecated in version 130; may be " - "removed in future release\n"))); -} - -TEST_F(CompileStringWithOptionsTest, GlobalWarnings) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_set_forced_version_profile(options_.get(), 400, - shaderc_profile_core); - EXPECT_THAT(CompilationWarnings(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, options_.get()), - HasSubstr("(version, profile) forced to be (400, core)," - " while in source code it is (550, none)\n")); -} - -TEST_F(CompileStringWithOptionsTest, GlobalWarningsAsErrors) { - shaderc_compile_options_set_warnings_as_errors(options_.get()); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_set_forced_version_profile(options_.get(), 400, - shaderc_profile_core); - EXPECT_THAT(CompilationErrors(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, options_.get()), - HasSubstr("(version, profile) forced to be (400, core)," - " while in source code it is (550, none)\n")); -} - -TEST_F(CompileStringWithOptionsTest, SuppressGlobalWarnings) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_set_suppress_warnings(options_.get()); - shaderc_compile_options_set_forced_version_profile(options_.get(), 400, - shaderc_profile_core); - EXPECT_EQ("", - CompilationWarnings(kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - SuppressWarningsModeFirstOverridesWarningsAsErrorsMode) { - // Sets suppress-warnings mode first, then sets warnings-as-errors mode. - // suppress-warnings mode should override warnings-as-errors mode. - shaderc_compile_options_set_suppress_warnings(options_.get()); - shaderc_compile_options_set_warnings_as_errors(options_.get()); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - - // Warnings on particular lines should be inhibited. - Compilation comp_line(compiler_.get_compiler_handle(), - kDeprecatedAttributeShader, shaderc_glsl_vertex_shader, - "shader", "main", options_.get()); - EXPECT_EQ(0u, shaderc_result_get_num_warnings(comp_line.result())); - - // Global warnings should be inhibited. - Compilation comp_global( - compiler_.get_compiler_handle(), kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, "shader", "main", options_.get()); - EXPECT_EQ(0u, shaderc_result_get_num_warnings(comp_global.result())); -} - -TEST_F(CompileStringWithOptionsTest, - SuppressWarningsModeSecondOverridesWarningsAsErrorsMode) { - // Sets suppress-warnings mode first, then sets warnings-as-errors mode. - // suppress-warnings mode should override warnings-as-errors mode. - shaderc_compile_options_set_warnings_as_errors(options_.get()); - shaderc_compile_options_set_suppress_warnings(options_.get()); - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - - // Warnings on particular lines should be inhibited. - Compilation comp_line(compiler_.get_compiler_handle(), - kDeprecatedAttributeShader, shaderc_glsl_vertex_shader, - "shader", "main", options_.get()); - EXPECT_EQ(0u, shaderc_result_get_num_warnings(comp_line.result())); - - // Global warnings should be inhibited. - Compilation comp_global( - compiler_.get_compiler_handle(), kMinimalUnknownVersionShader, - shaderc_glsl_vertex_shader, "shader", "main", options_.get()); - EXPECT_EQ(0u, shaderc_result_get_num_warnings(comp_global.result())); -} - -TEST_F(CompileStringWithOptionsTest, IfDefCompileOption) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - shaderc_compile_options_add_macro_definition(options_.get(), "E", 1u, nullptr, - 0u); - const std::string kMinimalExpandedShader = - "#version 140\n" - "#ifdef E\n" - "void main(){}\n" - "#else\n" - "#error\n" - "#endif"; - EXPECT_TRUE(CompilesToValidSpv(compiler_, kMinimalExpandedShader, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F( - CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingOpenGLCompatibilityShaderToBinaryAndAlwaysFails) { - // Glslang does not support generating SPIR-V for compatibility profile - // shaders. - - EXPECT_FALSE(CompilesToValidSpv(compiler_, kOpenGLCompatibilityFragmentShader, - shaderc_glsl_fragment_shader, - options_.get())); - - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_opengl_compat, 0); - EXPECT_FALSE(CompilesToValidSpv(compiler_, kOpenGLCompatibilityFragmentShader, - shaderc_glsl_fragment_shader, - options_.get())); - - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_opengl, 0); - EXPECT_FALSE(CompilesToValidSpv(compiler_, kOpenGLCompatibilityFragmentShader, - shaderc_glsl_fragment_shader, - options_.get())); - - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, 0); - EXPECT_FALSE(CompilesToValidSpv(compiler_, kOpenGLCompatibilityFragmentShader, - shaderc_glsl_fragment_shader, - options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, CompilingFailsWhenTargetingOpenGLCompat) { - // Confirm that kOpenGLVertexShader fails when targeting OpenGL - // compatibility profile. - - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_opengl_compat, 0); - EXPECT_FALSE(CompilesToValidSpv(compiler_, kOpenGLVertexShader, - shaderc_glsl_vertex_shader, options_.get())); - const std::string errors = CompilationErrors( - kOpenGLVertexShader, shaderc_glsl_vertex_shader, options_.get()); - EXPECT_EQ(errors, "error: OpenGL compatibility profile is not supported"); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingOpenGLCoreShaderToBinary) { - // Confirm that kOpenGLVertexShader compiles when targeting OpenGL core - // profile. - - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_opengl, 0); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kOpenGLVertexShader, - shaderc_glsl_vertex_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_0ShaderToVulkan1_0Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeBarrier, - shaderc_glsl_compute_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_0ShaderToVulkan1_1Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeBarrier, - shaderc_glsl_compute_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_1ShaderToVulkan1_0Fails) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - EXPECT_FALSE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, - shaderc_glsl_compute_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_1ShaderToVulkan1_1Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, - shaderc_glsl_compute_shader, options_.get())); -} - -// task shader -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_0TaskShaderToVulkan1_0Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderTaskBarrier, - shaderc_glsl_task_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_0TaskShaderToVulkan1_1Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderTaskBarrier, - shaderc_glsl_task_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_1TaskShaderToVulkan1_0Fails) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - EXPECT_FALSE(CompilesToValidSpv(compiler_, kGlslShaderTaskSubgroupBarrier, - shaderc_glsl_task_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_1TaskShaderToVulkan1_1Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderTaskSubgroupBarrier, - shaderc_glsl_task_shader, options_.get())); -} - -// mesh shader -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_0MeshShaderToVulkan1_0Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderMeshBarrier, - shaderc_glsl_mesh_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_0MeshShaderToVulkan1_1Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderMeshBarrier, - shaderc_glsl_mesh_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_1MeshShaderToVulkan1_0Fails) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_0); - EXPECT_FALSE(CompilesToValidSpv(compiler_, kGlslShaderMeshSubgroupBarrier, - shaderc_glsl_mesh_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - TargetEnvRespectedWhenCompilingVulkan1_1MeshShaderToVulkan1_1Succeeds) { - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, - shaderc_env_version_vulkan_1_1); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderMeshSubgroupBarrier, - shaderc_glsl_mesh_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, - DISABLED_TargetEnvIgnoredWhenPreprocessing) { - // This test is disabled since some versions of glslang may refuse to compile - // very old shaders to SPIR-V with OpenGL target. Re-enable and rewrite this - // test once we have a differential set of environments to test. - const auto output_type = OutputType::PreprocessedText; - - EXPECT_TRUE(CompilationSuccess(kOpenGLCompatibilityFragmentShader, - shaderc_glsl_fragment_shader, options_.get(), - output_type)); - - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_opengl_compat, 0); - EXPECT_TRUE(CompilationSuccess(kOpenGLCompatibilityFragmentShader, - shaderc_glsl_fragment_shader, options_.get(), - output_type)); - - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_opengl, 0); - EXPECT_TRUE(CompilationSuccess(kOpenGLCompatibilityFragmentShader, - shaderc_glsl_fragment_shader, options_.get(), - output_type)); - - shaderc_compile_options_set_target_env(options_.get(), - shaderc_target_env_vulkan, 0); - EXPECT_TRUE(CompilationSuccess(kOpenGLCompatibilityFragmentShader, - shaderc_glsl_fragment_shader, options_.get(), - output_type)); -} - -TEST_F(CompileStringTest, ShaderKindRespected) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string kVertexShader = - "#version 140\nvoid main(){ gl_Position = vec4(0);}"; - EXPECT_TRUE(CompilationSuccess(kVertexShader, shaderc_glsl_vertex_shader)); - EXPECT_FALSE(CompilationSuccess(kVertexShader, shaderc_glsl_fragment_shader)); -} - -TEST_F(CompileStringTest, ErrorsReported) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - EXPECT_THAT(CompilationErrors("int f(){return wrongname;}", - shaderc_glsl_vertex_shader), - HasSubstr("wrongname")); -} - -#ifndef SHADERC_DISABLE_THREADED_TESTS -TEST_F(CompileStringTest, MultipleThreadsCalling) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - bool results[10]; - std::vector threads; - for (auto& r : results) { - threads.emplace_back([&r, this]() { - r = CompilationSuccess("#version 140\nvoid main(){}", - shaderc_glsl_vertex_shader); - }); - } - for (auto& t : threads) { - t.join(); - } - EXPECT_THAT(results, Each(true)); -} -#endif - -TEST_F(CompileKindsTest, Vertex) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string kVertexShader = - "#version 140\nvoid main(){ gl_Position = vec4(0);}"; - EXPECT_TRUE(CompilationSuccess(kVertexShader, shaderc_glsl_vertex_shader)); -} - -TEST_F(CompileKindsTest, Fragment) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string kFragShader = - "#version 140\nvoid main(){ gl_FragColor = vec4(0);}"; - EXPECT_TRUE(CompilationSuccess(kFragShader, shaderc_glsl_fragment_shader)); -} - -TEST_F(CompileKindsTest, Compute) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string kCompShader = - R"(#version 310 es - void main() {} - )"; - EXPECT_TRUE(CompilationSuccess(kCompShader, shaderc_glsl_compute_shader)); -} - -TEST_F(CompileKindsTest, Geometry) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string kGeoShader = - - R"(#version 310 es - #extension GL_OES_geometry_shader : enable - layout(points) in; - layout(points, max_vertices=1) out; - void main() { - gl_Position = vec4(1.0); - EmitVertex(); - EndPrimitive(); - } - )"; - EXPECT_TRUE(CompilationSuccess(kGeoShader, shaderc_glsl_geometry_shader)); -} - -TEST_F(CompileKindsTest, TessControl) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string kTessControlShader = - R"(#version 310 es - #extension GL_OES_tessellation_shader : enable - layout(vertices=1) out; - void main() {} - )"; - EXPECT_TRUE( - CompilationSuccess(kTessControlShader, shaderc_glsl_tess_control_shader)); -} - -TEST_F(CompileKindsTest, TessEvaluation) { - ASSERT_NE(nullptr, compiler_.get_compiler_handle()); - const std::string kTessEvaluationShader = - R"(#version 310 es - #extension GL_OES_tessellation_shader : enable - layout(triangles, equal_spacing, ccw) in; - void main() { - gl_Position = vec4(gl_TessCoord, 1.0); - } - )"; - EXPECT_TRUE(CompilationSuccess(kTessEvaluationShader, - shaderc_glsl_tess_evaluation_shader)); -} - -// A test case for ParseVersionProfileTest needs: 1) the input string, 2) -// expected parsing results, including 'succeed' flag, version value, and -// profile enum. -struct ParseVersionProfileTestCase { - ParseVersionProfileTestCase( - const std::string& input_string, bool expected_succeed, - int expected_version = 0, - shaderc_profile expected_profile = shaderc_profile_none) - : input_string_(input_string), - expected_succeed_(expected_succeed), - expected_version_(expected_version), - expected_profile_(expected_profile) {} - std::string input_string_; - bool expected_succeed_; - int expected_version_; - shaderc_profile expected_profile_; -}; - -// Test for a helper function to parse version and profile from string. -using ParseVersionProfileTest = - testing::TestWithParam; - -TEST_P(ParseVersionProfileTest, FromNullTerminatedString) { - const ParseVersionProfileTestCase& test_case = GetParam(); - int version; - shaderc_profile profile; - bool succeed = shaderc_parse_version_profile(test_case.input_string_.c_str(), - &version, &profile); - EXPECT_EQ(test_case.expected_succeed_, succeed); - // check the return version and profile only when the parsing succeeds. - if (succeed) { - EXPECT_EQ(test_case.expected_version_, version); - EXPECT_EQ(test_case.expected_profile_, profile); - } -} - -INSTANTIATE_TEST_SUITE_P( - HelperMethods, ParseVersionProfileTest, - testing::ValuesIn(std::vector{ - // Valid version profiles - ParseVersionProfileTestCase("450core", true, 450, shaderc_profile_core), - ParseVersionProfileTestCase("450compatibility", true, 450, - shaderc_profile_compatibility), - ParseVersionProfileTestCase("310es", true, 310, shaderc_profile_es), - ParseVersionProfileTestCase("100", true, 100, shaderc_profile_none), - - // Invalid version profiles, the expected_version and expected_profile - // doesn't matter as they won't be checked if the tests pass correctly. - ParseVersionProfileTestCase("totally_wrong", false), - ParseVersionProfileTestCase("111core", false), - ParseVersionProfileTestCase("450wrongprofile", false), - ParseVersionProfileTestCase("", false), - })); - -TEST_F(CompileStringTest, NullSourceNameFailsCompilingToBinary) { - EXPECT_THAT(CompilationErrors(kEmpty310ESShader, shaderc_glsl_vertex_shader, - nullptr, OutputType::SpirvBinary, nullptr), - HasSubstr("Input file name string was null.")); -} - -TEST_F(CompileStringTest, NullSourceNameFailsCompilingToAssemblyText) { - EXPECT_THAT( - CompilationErrors(kEmpty310ESShader, shaderc_glsl_vertex_shader, nullptr, - OutputType::SpirvAssemblyText, nullptr), - HasSubstr("Input file name string was null.")); -} - -TEST_F(CompileStringTest, NullSourceNameFailsCompilingToPreprocessedText) { - EXPECT_THAT(CompilationErrors(kEmpty310ESShader, shaderc_glsl_vertex_shader, - nullptr, OutputType::PreprocessedText, nullptr), - HasSubstr("Input file name string was null.")); -} - -const char kGlslVertexShader[] = - "#version 140\nvoid main(){ gl_Position = vec4(0);}"; - -const char kHlslVertexShader[] = - "float4 EntryPoint(uint index : SV_VERTEXID) : SV_POSITION\n" - "{ return float4(1.0, 2.0, 3.0, 4.0); }"; - -TEST_F(CompileStringTest, LangGlslOnGlslVertexSucceeds) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_glsl); - EXPECT_TRUE(CompilationSuccess(kGlslVertexShader, shaderc_glsl_vertex_shader, - options_.get())); -} - -TEST_F(CompileStringTest, LangGlslOnHlslVertexFails) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_glsl); - EXPECT_FALSE(CompilationSuccess(kHlslVertexShader, shaderc_glsl_vertex_shader, - options_.get())); -} - -TEST_F(CompileStringTest, LangHlslOnGlslVertexFails) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_hlsl); - EXPECT_FALSE(CompilationSuccess(kGlslVertexShader, shaderc_glsl_vertex_shader, - options_.get())); -} - -TEST_F(CompileStringTest, LangHlslOnHlslVertexSucceeds) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_hlsl); - EXPECT_TRUE(CompilationSuccess(kHlslVertexShader, shaderc_glsl_vertex_shader, - options_.get())); -} - -TEST(EntryPointTest, - LangGlslOnHlslVertexSucceedsButAssumesEntryPointNameIsMain) { - Compiler compiler; - Options options; - auto compilation = - Compilation(compiler.get_compiler_handle(), kGlslVertexShader, - shaderc_glsl_vertex_shader, "shader", "blah blah blah", - options.get(), OutputType::SpirvAssemblyText); - - EXPECT_THAT(shaderc_result_get_bytes(compilation.result()), - HasSubstr("OpEntryPoint Vertex %main \"main\"")) - << std::string(shaderc_result_get_bytes(compilation.result())); -} - -TEST(EntryPointTest, LangHlslOnHlslVertexSucceedsWithGivenEntryPointName) { - Compiler compiler; - Options options; - shaderc_compile_options_set_source_language(options.get(), - shaderc_source_language_hlsl); - auto compilation = - Compilation(compiler.get_compiler_handle(), kHlslVertexShader, - shaderc_glsl_vertex_shader, "shader", "EntryPoint", - options.get(), OutputType::SpirvAssemblyText); - - EXPECT_THAT(shaderc_result_get_bytes(compilation.result()), - HasSubstr("OpEntryPoint Vertex %EntryPoint \"EntryPoint\"")) - << std::string(shaderc_result_get_bytes(compilation.result())); -} - -// Returns a fragment shader accessing a texture with the given -// offset. -std::string ShaderWithTexOffset(int offset) { - std::ostringstream oss; - oss << "#version 450\n" - "layout (binding=0) uniform sampler1D tex;\n" - "void main() { vec4 x = textureOffset(tex, 1.0, " - << offset << "); }\n"; - return oss.str(); -} - -// Ensure compilation is sensitive to limit setting. Sample just -// two particular limits. -TEST_F(CompileStringTest, LimitsTexelOffsetDefault) { - EXPECT_FALSE(CompilationSuccess(ShaderWithTexOffset(-9).c_str(), - shaderc_glsl_fragment_shader, - options_.get())); - EXPECT_TRUE(CompilationSuccess(ShaderWithTexOffset(-8).c_str(), - shaderc_glsl_fragment_shader, options_.get())); - EXPECT_TRUE(CompilationSuccess(ShaderWithTexOffset(7).c_str(), - shaderc_glsl_fragment_shader, options_.get())); - EXPECT_FALSE(CompilationSuccess(ShaderWithTexOffset(8).c_str(), - shaderc_glsl_fragment_shader, - options_.get())); -} - -TEST_F(CompileStringTest, LimitsTexelOffsetLowerMinimum) { - shaderc_compile_options_set_limit( - options_.get(), shaderc_limit_min_program_texel_offset, -99); - EXPECT_FALSE(CompilationSuccess(ShaderWithTexOffset(-100).c_str(), - shaderc_glsl_fragment_shader, - options_.get())); - EXPECT_TRUE(CompilationSuccess(ShaderWithTexOffset(-99).c_str(), - shaderc_glsl_fragment_shader, options_.get())); -} - -TEST_F(CompileStringTest, LimitsTexelOffsetHigherMaximum) { - shaderc_compile_options_set_limit(options_.get(), - shaderc_limit_max_program_texel_offset, 10); - EXPECT_TRUE(CompilationSuccess(ShaderWithTexOffset(10).c_str(), - shaderc_glsl_fragment_shader, options_.get())); - EXPECT_FALSE(CompilationSuccess(ShaderWithTexOffset(11).c_str(), - shaderc_glsl_fragment_shader, - options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, UniformsWithoutBindingsFailCompilation) { - const std::string errors = - CompilationErrors(kShaderWithUniformsWithoutBindings, - shaderc_glsl_vertex_shader, options_.get()); - EXPECT_THAT(errors, - HasSubstr("sampler/texture/image requires layout(binding=X)")); -} - -TEST_F(CompileStringWithOptionsTest, - UniformsWithoutBindingsOptionSetAutoBindingsAssignsBindings) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 4")); -} - -TEST_F(CompileStringWithOptionsTest, AutoBindUniformsOptionsSurvivesCloning) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, - cloned_options.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 4")); -} - -TEST_F(CompileStringWithOptionsTest, - SetBindingBaseForTextureAdjustsTextureBindingsOnly) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - shaderc_compile_options_set_binding_base(options_.get(), - shaderc_uniform_kind_texture, 44); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 44")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 3")); -} - -TEST_F(CompileStringWithOptionsTest, - SetBindingBaseForSamplerAdjustsSamplerBindingsOnly) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - shaderc_compile_options_set_binding_base(options_.get(), - shaderc_uniform_kind_sampler, 44); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 44")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 3")); -} - -TEST_F(CompileStringWithOptionsTest, - SetBindingBaseForImageAdjustsImageBindingsOnly) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - shaderc_compile_options_set_binding_base(options_.get(), - shaderc_uniform_kind_image, 44); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 44")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 45")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 2")); -} - -TEST_F(CompileStringWithOptionsTest, - SetBindingBaseForBufferAdjustsBufferBindingsOnly) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - shaderc_compile_options_set_binding_base(options_.get(), - shaderc_uniform_kind_buffer, 44); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 44")); -} - -TEST_F(CompileStringWithOptionsTest, SetBindingBaseSurvivesCloning) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - shaderc_compile_options_set_binding_base(options_.get(), - shaderc_uniform_kind_texture, 40); - shaderc_compile_options_set_binding_base(options_.get(), - shaderc_uniform_kind_sampler, 50); - shaderc_compile_options_set_binding_base(options_.get(), - shaderc_uniform_kind_image, 60); - shaderc_compile_options_set_binding_base(options_.get(), - shaderc_uniform_kind_buffer, 70); - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_glsl_vertex_shader, - cloned_options.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 40")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 50")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 60")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 61")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 70")); -} - -TEST(Compiler, IncludeWithoutOptionsReturnsValidError) { - auto compiler = shaderc_compiler_initialize(); - const char source[] = "#version 450\n#include \"no where\""; - auto result = shaderc_compile_into_spv(compiler, source, strlen(source), - shaderc_glsl_vertex_shader, "file", - "main", nullptr); - EXPECT_EQ(shaderc_compilation_status_compilation_error, - shaderc_result_get_compilation_status(result)); - EXPECT_THAT(shaderc_result_get_error_message(result), - HasSubstr("error: '#include' : #error unexpected include " - "directive for header name: no where")); - - shaderc_result_release(result); - shaderc_compiler_release(compiler); -} - -TEST_F( - CompileStringWithOptionsTest, - SetBindingBaseForTextureForVertexAdjustsTextureBindingsOnlyCompilingAsVertex) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - shaderc_compile_options_set_binding_base_for_stage( - options_.get(), shaderc_vertex_shader, shaderc_uniform_kind_texture, 100); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_vertex_shader, options_.get(), - OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 100")) - << disassembly_text; - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 3")); -} - -TEST_F(CompileStringWithOptionsTest, - SetBindingBaseForTextureForVertexIgnoredWhenCompilingAsFragment) { - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - // This is ignored since we're compiling as a different stage. - shaderc_compile_options_set_binding_base_for_stage( - options_.get(), shaderc_vertex_shader, shaderc_uniform_kind_texture, 100); - const std::string disassembly_text = CompilationOutput( - kShaderWithUniformsWithoutBindings, shaderc_fragment_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_tex Binding 0")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorate %my_ubo Binding 4")); -} - -TEST_F(CompileStringWithOptionsTest, GlslDefaultPackingUsed) { - const std::string disassembly_text = - CompilationOutput(kGlslShaderWeirdPacking, shaderc_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpMemberDecorate %B 1 Offset 16")); -} - -TEST_F(CompileStringWithOptionsTest, HlslOffsetsOptionDisableRespected) { - shaderc_compile_options_set_hlsl_offsets(options_.get(), false); - const std::string disassembly_text = - CompilationOutput(kGlslShaderWeirdPacking, shaderc_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpMemberDecorate %B 1 Offset 16")); -} - -TEST_F(CompileStringWithOptionsTest, HlslOffsetsOptionEnableRespected) { - shaderc_compile_options_set_hlsl_offsets(options_.get(), true); - const std::string disassembly_text = - CompilationOutput(kGlslShaderWeirdPacking, shaderc_vertex_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpMemberDecorate %B 1 Offset 4")); -} - -TEST_F(CompileStringWithOptionsTest, HlslFunctionality1OffByDefault) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_hlsl); - // The counter should automatically get a binding. - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - const std::string disassembly_text = - CompilationOutput(kHlslShaderWithCounterBuffer, shaderc_fragment_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, Not(HasSubstr("OpDecorateString"))) - << disassembly_text; -} - -TEST_F(CompileStringWithOptionsTest, HlslFunctionality1Respected) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_hlsl); - shaderc_compile_options_set_hlsl_functionality1(options_.get(), true); - // The counter should automatically get a binding. - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - const std::string disassembly_text = - CompilationOutput(kHlslShaderWithCounterBuffer, shaderc_fragment_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorateString")); -} - -TEST_F(CompileStringWithOptionsTest, HlslFunctionality1SurvivesCloning) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_hlsl); - shaderc_compile_options_set_hlsl_functionality1(options_.get(), true); - // The counter should automatically get a binding. - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - const std::string disassembly_text = - CompilationOutput(kHlslShaderWithCounterBuffer, shaderc_fragment_shader, - cloned_options.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpDecorateString")); -} - -TEST_F(CompileStringWithOptionsTest, HlslFlexibleMemoryLayoutAllowed) { - shaderc_compile_options_set_source_language(options_.get(), - shaderc_source_language_hlsl); - shaderc_compile_options_set_optimization_level( - options_.get(), shaderc_optimization_level_performance); - // There is no way to set the counter's binding, so set it automatically. - // See https://github.com/KhronosGroup/glslang/issues/1616 - shaderc_compile_options_set_auto_bind_uniforms(options_.get(), true); - EXPECT_TRUE(CompilesToValidSpv(compiler_, kHlslMemLayoutResourceSelect, - shaderc_fragment_shader, options_.get())); -} - -TEST_F(CompileStringWithOptionsTest, ClampMapsToFClampByDefault) { - const std::string disassembly_text = - CompilationOutput(kGlslShaderWithClamp, shaderc_fragment_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpExtInst %v4float %1 FClamp")); -} - -TEST_F(CompileStringWithOptionsTest, ClampMapsToNClampWithNanClamp) { - shaderc_compile_options_set_nan_clamp(options_.get(), true); - const std::string disassembly_text = - CompilationOutput(kGlslShaderWithClamp, shaderc_fragment_shader, - options_.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpExtInst %v4float %1 NClamp")); -} - -TEST_F(CompileStringWithOptionsTest, NanClampSurvivesCloning) { - shaderc_compile_options_set_nan_clamp(options_.get(), true); - compile_options_ptr cloned_options( - shaderc_compile_options_clone(options_.get())); - const std::string disassembly_text = - CompilationOutput(kGlslShaderWithClamp, shaderc_fragment_shader, - cloned_options.get(), OutputType::SpirvAssemblyText); - EXPECT_THAT(disassembly_text, HasSubstr("OpExtInst %v4float %1 NClamp")); -} - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/Android.mk b/lib/shaderc/libshaderc_util/Android.mk deleted file mode 100644 index ade568ca3..000000000 --- a/lib/shaderc/libshaderc_util/Android.mk +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE:=shaderc_util -LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -DENABLE_HLSL=1 -LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/include -LOCAL_SRC_FILES:=src/args.cc \ - src/compiler.cc \ - src/file_finder.cc \ - src/io_shaderc.cc \ - src/message.cc \ - src/resources.cc \ - src/shader_stage.cc \ - src/spirv_tools_wrapper.cc \ - src/version_profile.cc -LOCAL_STATIC_LIBRARIES:=SPIRV SPIRV-Tools-opt -LOCAL_C_INCLUDES:=$(LOCAL_PATH)/include -include $(BUILD_STATIC_LIBRARY) diff --git a/lib/shaderc/libshaderc_util/CMakeLists.txt b/lib/shaderc/libshaderc_util/CMakeLists.txt deleted file mode 100644 index 99ce3c44e..000000000 --- a/lib/shaderc/libshaderc_util/CMakeLists.txt +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project(libshaderc_util) - -add_library(shaderc_util STATIC - include/libshaderc_util/counting_includer.h - include/libshaderc_util/file_finder.h - include/libshaderc_util/format.h - include/libshaderc_util/io_shaderc.h - include/libshaderc_util/mutex.h - include/libshaderc_util/message.h - include/libshaderc_util/resources.h - include/libshaderc_util/spirv_tools_wrapper.h - include/libshaderc_util/string_piece.h - include/libshaderc_util/universal_unistd.h - include/libshaderc_util/version_profile.h - src/args.cc - src/compiler.cc - src/file_finder.cc - src/io_shaderc.cc - src/message.cc - src/resources.cc - src/shader_stage.cc - src/spirv_tools_wrapper.cc - src/version_profile.cc -) - -shaderc_default_compile_options(shaderc_util) -target_include_directories(shaderc_util - PUBLIC include PRIVATE ${glslang_SOURCE_DIR}) -# We use parts of Glslang's HLSL compilation interface, which -# now requires this preprocessor definition. -add_definitions(-DENABLE_HLSL) - -find_package(Threads) -target_link_libraries(shaderc_util PRIVATE - glslang OSDependent OGLCompiler HLSL glslang SPIRV - SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) - -shaderc_add_tests( - TEST_PREFIX shaderc_util - LINK_LIBS shaderc_util - TEST_NAMES - counting_includer - string_piece - format - file_finder - io_shaderc - message - mutex - version_profile) - -if(${SHADERC_ENABLE_TESTS}) - target_include_directories(shaderc_util_counting_includer_test - PRIVATE ${glslang_SOURCE_DIR}) - target_include_directories(shaderc_util_version_profile_test - PRIVATE ${glslang_SOURCE_DIR}) -endif() - -shaderc_add_tests( - TEST_PREFIX shaderc_util - LINK_LIBS shaderc_util - INCLUDE_DIRS - ${glslang_SOURCE_DIR} - ${spirv-tools_SOURCE_DIR}/include - TEST_NAMES - compiler) - -# This target copies content of testdata into the build directory. -add_custom_target(testdata COMMAND - ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/testdata/copy-to-build.cmake - COMMENT "Copy testdata into build directory") - -if(${SHADERC_ENABLE_TESTS}) - add_dependencies(shaderc_util_file_finder_test testdata) - add_dependencies(shaderc_util_io_shaderc_test testdata) -endif() diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/args.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/args.h deleted file mode 100644 index 1d08604b4..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/args.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2019 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_INC_ARGS_H -#define LIBSHADERC_UTIL_INC_ARGS_H - -#include -#include - -#include "libshaderc_util/string_piece.h" - -namespace shaderc_util { - -// Gets the option argument for the option at *index in argv in a way consistent -// with clang/gcc. On success, returns true and writes the parsed argument into -// *option_argument. Returns false if any errors occur. After calling this -// function, *index will be the index of the last command line argument -// consumed. -bool GetOptionArgument(int argc, char** argv, int* index, - const std::string& option, - string_piece* option_argument); - -// Parses the given string as a number of the specified type. Returns true -// if parsing succeeded, and stores the parsed value via |value|. -// (I've worked out the general case for this in -// SPIRV-Tools source/util/parse_number.h. -- dneto) -bool ParseUint32(const std::string& str, uint32_t* value); - -} // namespace shaderc_util -#endif // LIBSHADERC_UTIL_INC_ARGS_H diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/compiler.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/compiler.h deleted file mode 100644 index 1a46f4e50..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/compiler.h +++ /dev/null @@ -1,621 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_INC_COMPILER_H -#define LIBSHADERC_UTIL_INC_COMPILER_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glslang/Public/ShaderLang.h" - -#include "counting_includer.h" -#include "file_finder.h" -#include "mutex.h" -#include "resources.h" -#include "string_piece.h" - -// Fix a typo in glslang/Public/ShaderLang.h -#define EShTargetClientVersion EshTargetClientVersion - -namespace shaderc_util { - -// To break recursive including. This header is already included in -// spirv_tools_wrapper.h, so cannot include spirv_tools_wrapper.h here. -enum class PassId; - -// Initializes glslang on creation, and destroys it on completion. -// Used to tie gslang process operations to object lifetimes. -// Additionally initialization/finalization of glslang is not thread safe, so -// synchronizes these operations. -class GlslangInitializer { - public: - GlslangInitializer(); - ~GlslangInitializer(); - - private: - static unsigned int initialize_count_; - - // Using a bare pointer here to avoid any global class construction at the - // beginning of the execution. - static std::mutex* glslang_mutex_; -}; - -// Maps macro names to their definitions. Stores string_pieces, so the -// underlying strings must outlive it. -using MacroDictionary = std::unordered_map; - -// Holds all of the state required to compile source GLSL into SPIR-V. -class Compiler { - public: - // Source language - enum class SourceLanguage { - GLSL, // The default - HLSL, - }; - - // Target environment. - enum class TargetEnv { - Vulkan, // Default to Vulkan 1.0 - OpenGL, // Default to OpenGL 4.5 - OpenGLCompat, // Support removed. Generates error if used. - }; - - // Target environment versions. These numbers match those used by Glslang. - enum class TargetEnvVersion : uint32_t { - Default = 0, // Default for the corresponding target environment - // For Vulkan, use numbering scheme from vulkan.h - Vulkan_1_0 = ((1 << 22)), // Vulkan 1.0 - Vulkan_1_1 = ((1 << 22) | (1 << 12)), // Vulkan 1.1 - Vulkan_1_2 = ((1 << 22) | (2 << 12)), // Vulkan 1.2 - Vulkan_1_3 = ((1 << 22) | (3 << 12)), // Vulkan 1.2 - // For OpenGL, use the numbering from #version in shaders. - OpenGL_4_5 = 450, - }; - - // SPIR-V version. - enum class SpirvVersion : uint32_t { - v1_0 = 0x010000u, - v1_1 = 0x010100u, - v1_2 = 0x010200u, - v1_3 = 0x010300u, - v1_4 = 0x010400u, - v1_5 = 0x010500u, - v1_6 = 0x010600u, - }; - - enum class OutputType { - SpirvBinary, // A binary module, as defined by the SPIR-V specification. - SpirvAssemblyText, // Assembly syntax defined by the SPIRV-Tools project. - PreprocessedText, // Preprocessed source code. - }; - - // Supported optimization levels. - enum class OptimizationLevel { - Zero, // No optimization. - Size, // Optimization towards reducing code size. - Performance, // Optimization towards better performance. - }; - - // Resource limits. These map to the "max*" fields in - // glslang::TBuiltInResource. - enum class Limit { -#define RESOURCE(NAME, FIELD, CNAME) NAME, -#include "resources.inc" -#undef RESOURCE - }; - - // Types of uniform variables. - enum class UniformKind { - // Image, and image buffer. - Image = 0, - // Pure sampler. - Sampler = 1, - // Sampled texture in GLSL. - // Shader Resource View, for HLSL. (Read-only image or storage buffer.) - Texture = 2, - // Uniform Buffer Object, or UBO, in GLSL. - // Also a Cbuffer in HLSL. - Buffer = 3, - // Shader Storage Buffer Object, or SSBO - StorageBuffer = 4, - // Uniform Access View, in HLSL. (Writable storage image or storage - // buffer.) - UnorderedAccessView = 5, - }; - enum { kNumUniformKinds = int(UniformKind::UnorderedAccessView) + 1 }; - - // Shader pipeline stage. - // TODO(dneto): Replaces interface uses of EShLanguage with this enum. - enum class Stage { - Vertex, - TessEval, - TessControl, - Geometry, - Fragment, - Compute, - RayGenNV, - IntersectNV, - AnyHitNV, - ClosestHitNV, - MissNV, - CallableNV, - TaskNV, - MeshNV, - StageEnd, - }; - enum { kNumStages = int(Stage::StageEnd) }; - - // Returns a std::array of all the Stage values. - const std::array& stages() const { - static std::array values{{ - Stage::Vertex, - Stage::TessEval, - Stage::TessControl, - Stage::Geometry, - Stage::Fragment, - Stage::Compute, - Stage::RayGenNV, - Stage::IntersectNV, - Stage::AnyHitNV, - Stage::ClosestHitNV, - Stage::MissNV, - Stage::CallableNV, - Stage::TaskNV, - Stage::MeshNV, - }}; - return values; - } - - // Creates an default compiler instance targeting at Vulkan environment. Uses - // version 110 and no profile specification as the default for GLSL. - Compiler() - // The default version for glsl is 110, or 100 if you are using an es - // profile. But we want to default to a non-es profile. - : default_version_(110), - default_profile_(ENoProfile), - force_version_profile_(false), - warnings_as_errors_(false), - suppress_warnings_(false), - generate_debug_info_(false), - enabled_opt_passes_(), - target_env_(TargetEnv::Vulkan), - target_env_version_(TargetEnvVersion::Default), - target_spirv_version_(SpirvVersion::v1_0), - target_spirv_version_is_forced_(false), - source_language_(SourceLanguage::GLSL), - limits_(kDefaultTBuiltInResource), - auto_bind_uniforms_(false), - auto_combined_image_sampler_(false), - auto_binding_base_(), - auto_map_locations_(false), - hlsl_iomap_(false), - hlsl_offsets_(false), - hlsl_legalization_enabled_(true), - hlsl_functionality1_enabled_(false), - invert_y_enabled_(false), - nan_clamp_(false), - hlsl_explicit_bindings_() {} - - // Requests that the compiler place debug information into the object code, - // such as identifier names and line numbers. - void SetGenerateDebugInfo(); - - // Sets the optimization level to the given level. Only the last one takes - // effect if multiple calls of this method exist. - void SetOptimizationLevel(OptimizationLevel level); - - // Enables or disables HLSL legalization passes. - void EnableHlslLegalization(bool hlsl_legalization_enabled); - - // Enables or disables extension SPV_GOOGLE_hlsl_functionality1 - void EnableHlslFunctionality1(bool enable); - - // Enables or disables invert position.Y output in vertex shader. - void EnableInvertY(bool enable); - - // Sets whether the compiler generates code for max and min builtins which, - // if given a NaN operand, will return the other operand. Also, the clamp - // builtin will favour the non-NaN operands, as if clamp were implemented - // as a composition of max and min. - void SetNanClamp(bool enable); - - // When a warning is encountered it treat it as an error. - void SetWarningsAsErrors(); - - // Any warning message generated is suppressed before it is output. - void SetSuppressWarnings(); - - // Adds an implicit macro definition obeyed by subsequent CompileShader() - // calls. The macro and definition should be passed in with their char* - // pointer and their lengths. They can be modified or deleted after this - // function has returned. - void AddMacroDefinition(const char* macro, size_t macro_length, - const char* definition, size_t definition_length); - - // Sets the target environment, including version. The version value should - // be 0 or one of the values from TargetEnvVersion. The default value maps - // to Vulkan 1.0 if the target environment is Vulkan, and it maps to OpenGL - // 4.5 if the target environment is OpenGL. - void SetTargetEnv(TargetEnv env, - TargetEnvVersion version = TargetEnvVersion::Default); - - // Sets the target version of SPIR-V. The module will use this version - // of SPIR-V. Defaults to the highest version of SPIR-V required to be - // supported by the target environment. E.g. default to SPIR-V 1.0 for - // Vulkan 1.0, and SPIR-V 1.3 for Vulkan 1.1. - void SetTargetSpirv(SpirvVersion version); - - // Sets the souce language. - void SetSourceLanguage(SourceLanguage lang); - - // Forces (without any verification) the default version and profile for - // subsequent CompileShader() calls. - void SetForcedVersionProfile(int version, EProfile profile); - - // Sets a resource limit. - void SetLimit(Limit limit, int value); - - // Returns the current limit. - int GetLimit(Limit limit) const; - - // Set whether the compiler automatically assigns bindings to - // uniform variables that don't have explicit bindings. - void SetAutoBindUniforms(bool auto_bind) { auto_bind_uniforms_ = auto_bind; } - - // Sets whether the compiler should automatically remove sampler variables - // and convert image variables to combined image-sampler variables. - void SetAutoCombinedImageSampler(bool auto_combine) { - auto_combined_image_sampler_ = auto_combine; - } - - // Sets the lowest binding number used when automatically assigning bindings - // for uniform resources of the given type, for all shader stages. The default - // base is zero. - void SetAutoBindingBase(UniformKind kind, uint32_t base) { - for (auto stage : stages()) { - SetAutoBindingBaseForStage(stage, kind, base); - } - } - - // Sets the lowest binding number used when automatically assigning bindings - // for uniform resources of the given type for a specific shader stage. The - // default base is zero. - void SetAutoBindingBaseForStage(Stage stage, UniformKind kind, - uint32_t base) { - auto_binding_base_[static_cast(stage)][static_cast(kind)] = base; - } - - // Sets whether the compiler automatically assigns locations to - // uniform variables that don't have explicit locations. - void SetAutoMapLocations(bool auto_map) { auto_map_locations_ = auto_map; } - - // Use HLSL IO mapping rules for bindings. Default is false. - void SetHlslIoMapping(bool hlsl_iomap) { hlsl_iomap_ = hlsl_iomap; } - - // Use HLSL rules for offsets in "transparent" memory. These allow for - // tighter packing of some combinations of types than standard GLSL packings. - void SetHlslOffsets(bool hlsl_offsets) { hlsl_offsets_ = hlsl_offsets; } - - // Sets an explicit set and binding for the given HLSL register. - void SetHlslRegisterSetAndBinding(const std::string& reg, - const std::string& set, - const std::string& binding) { - for (auto stage : stages()) { - SetHlslRegisterSetAndBindingForStage(stage, reg, set, binding); - } - } - - // Sets an explicit set and binding for the given HLSL register in the given - // shader stage. For example, - // SetHlslRegisterSetAndBinding(Stage::Fragment, "t1", "4", "5") - // means register "t1" in a fragment shader should map to binding 5 in set 4. - // (Glslang wants this data as strings, not ints or enums.) The string data is - // copied. - void SetHlslRegisterSetAndBindingForStage(Stage stage, const std::string& reg, - const std::string& set, - const std::string& binding) { - hlsl_explicit_bindings_[static_cast(stage)].push_back(reg); - hlsl_explicit_bindings_[static_cast(stage)].push_back(set); - hlsl_explicit_bindings_[static_cast(stage)].push_back(binding); - } - - // Compiles the shader source in the input_source_string parameter. - // - // If the forced_shader stage parameter is not EShLangCount then - // the shader is assumed to be of the given stage. - // - // For HLSL compilation, entry_point_name is the null-terminated string for - // the entry point. For GLSL compilation, entry_point_name is ignored, and - // compilation assumes the entry point is named "main". - // - // The stage_callback function will be called if a shader_stage has - // not been forced and the stage can not be determined - // from the shader text. Any #include directives are parsed with the given - // includer. - // - // The initializer parameter must be a valid GlslangInitializer object. - // Acquire will be called on the initializer and the result will be - // destroyed before the function ends. - // - // The output_type parameter determines what kind of output should be - // produced. - // - // Any error messages are written as if the file name were error_tag. - // Any errors are written to the error_stream parameter. - // total_warnings and total_errors are incremented once for every - // warning or error encountered respectively. - // - // Returns a tuple consisting of three fields. 1) a boolean which is true when - // the compilation succeeded, and false otherwise; 2) a vector of 32-bit words - // which contains the compilation output data, either compiled SPIR-V binary - // code, or the text string generated in preprocessing-only or disassembly - // mode; 3) the size of the output data in bytes. When the output is SPIR-V - // binary code, the size is the number of bytes of valid data in the vector. - // If the output is a text string, the size equals the length of that string. - std::tuple, size_t> Compile( - const string_piece& input_source_string, EShLanguage forced_shader_stage, - const std::string& error_tag, const char* entry_point_name, - const std::function& - stage_callback, - CountingIncluder& includer, OutputType output_type, - std::ostream* error_stream, size_t* total_warnings, size_t* total_errors) const; - - static EShMessages GetDefaultRules() { - return static_cast(EShMsgSpvRules | EShMsgVulkanRules | - EShMsgCascadingErrors); - } - - protected: - // Preprocesses a shader whose filename is filename and content is - // shader_source. If preprocessing is successful, returns true, the - // preprocessed shader, and any warning message as a tuple. Otherwise, - // returns false, an empty string, and error messages as a tuple. - // - // The error_tag parameter is the name to use for outputting errors. - // The shader_source parameter is the input shader's source text. - // The shader_preamble parameter is a context-specific preamble internally - // prepended to shader_text without affecting the validity of its #version - // position. - // - // Any #include directives are processed with the given includer. - // - // If force_version_profile_ is set, the shader's version/profile is forced - // to be default_version_/default_profile_ regardless of the #version - // directive in the source code. - std::tuple PreprocessShader( - const std::string& error_tag, const string_piece& shader_source, - const string_piece& shader_preamble, CountingIncluder& includer) const; - - // Cleans up the preamble in a given preprocessed shader. - // - // The error_tag parameter is the name to be given for the main file. - // The pound_extension parameter is the #extension directive we prepended to - // the original shader source code via preamble. - // The num_include_directives parameter is the number of #include directives - // appearing in the original shader source code. - // The is_for_next_line means whether the #line sets the line number for the - // next line. - // - // If no #include directive is used in the shader source code, we can safely - // delete the #extension directive we injected via preamble. Otherwise, we - // need to adjust it if there exists a #version directive in the original - // shader source code. - std::string CleanupPreamble(const string_piece& preprocessed_shader, - const string_piece& error_tag, - const string_piece& pound_extension, - int num_include_directives, - bool is_for_next_line) const; - - // Determines version and profile from command line, or the source code. - // Returns the decoded version and profile pair on success. Otherwise, - // returns (0, ENoProfile). - std::pair DeduceVersionProfile( - const std::string& preprocessed_shader) const; - - // Determines the shader stage from pragmas embedded in the source text if - // possible. In the returned pair, the glslang EShLanguage is the shader - // stage deduced. If no #pragma directives for shader stage exist, it's - // EShLangCount. If errors occur, the second element in the pair is the - // error message. Otherwise, it's an empty string. - std::pair GetShaderStageFromSourceCode( - string_piece filename, const std::string& preprocessed_shader) const; - - // Determines version and profile from command line, or the source code. - // Returns the decoded version and profile pair on success. Otherwise, - // returns (0, ENoProfile). - std::pair DeduceVersionProfile( - const std::string& preprocessed_shader); - - // Gets version and profile specification from the given preprocessedshader. - // Returns the decoded version and profile pair on success. Otherwise, - // returns (0, ENoProfile). - std::pair GetVersionProfileFromSourceCode( - const std::string& preprocessed_shader) const; - - // Version to use when force_version_profile_ is true. - int default_version_; - // Profile to use when force_version_profile_ is true. - EProfile default_profile_; - // When true, use the default version and profile from eponymous data members. - bool force_version_profile_; - - // Macro definitions that must be available to reference in the shader source. - MacroDictionary predefined_macros_; - - // When true, treat warnings as errors. - bool warnings_as_errors_; - // Supress warnings when true. - bool suppress_warnings_; - - // When true, compilation will generate debug info with the binary SPIR-V - // output. - bool generate_debug_info_; - - // Optimization passes to be applied. - std::vector enabled_opt_passes_; - - // The target environment to compile with. This controls the glslang - // EshMessages bitmask, which determines which dialect of GLSL and which - // SPIR-V codegen semantics are used. This impacts the warning & error - // messages as well as the set of available builtins, as per the - // implementation of glslang. - TargetEnv target_env_; - - // The version number of the target environment. The numbering scheme is - // particular to each target environment. If this is 0, then use a default - // for that particular target environment. See libshaders/shaderc/shaderc.h - // for those defaults. - TargetEnvVersion target_env_version_; - - // The SPIR-V version to be used for the generated module. Defaults to 1.0. - SpirvVersion target_spirv_version_; - // True if the user explicitly set the target SPIR-V version. - bool target_spirv_version_is_forced_; - - // The source language. Defaults to GLSL. - SourceLanguage source_language_; - - // The resource limits to be used. - TBuiltInResource limits_; - - // True if the compiler should automatically bind uniforms that don't - // have explicit bindings. - bool auto_bind_uniforms_; - - // True if the compiler should automatically remove sampler variables - // and convert image variables to combined image-sampler variables. - bool auto_combined_image_sampler_; - - // The base binding number per uniform type, per stage, used when automatically - // binding uniforms that don't hzve explicit bindings in the shader source. - // The default is zero. - uint32_t auto_binding_base_[kNumStages][kNumUniformKinds]; - - // True if the compiler should automatically map uniforms that don't - // have explicit locations. - bool auto_map_locations_; - - // True if the compiler should use HLSL IO mapping rules when compiling HLSL. - bool hlsl_iomap_; - - // True if the compiler should determine block member offsets using HLSL - // packing rules instead of standard GLSL rules. - bool hlsl_offsets_; - - // True if the compiler should perform legalization optimization passes if - // source language is HLSL. - bool hlsl_legalization_enabled_; - - // True if the compiler should support extension SPV_GOOGLE_hlsl_functionality1. - bool hlsl_functionality1_enabled_; - - // True if the compiler should invert position.Y output in vertex shader. - bool invert_y_enabled_; - - // True if the compiler generates code for max and min builtins which, - // if given a NaN operand, will return the other operand. Also, the clamp - // builtin will favour the non-NaN operands, as if clamp were implemented - // as a composition of max and min. - bool nan_clamp_; - - // A sequence of triples, each triple representing a specific HLSL register - // name, and the set and binding numbers it should be mapped to, but in - // the form of strings. This is how Glslang wants to consume the data. - std::vector hlsl_explicit_bindings_[kNumStages]; -}; - -// Converts a string to a vector of uint32_t by copying the content of a given -// string to the vector and returns it. Appends '\0' at the end if extra bytes -// are required to complete the last element. -std::vector ConvertStringToVector(const std::string& str); - -// Converts a valid Glslang shader stage value to a Compiler::Stage value. -inline Compiler::Stage ConvertToStage(EShLanguage stage) { - switch (stage) { - case EShLangVertex: - return Compiler::Stage::Vertex; - case EShLangTessControl: - return Compiler::Stage::TessEval; - case EShLangTessEvaluation: - return Compiler::Stage::TessControl; - case EShLangGeometry: - return Compiler::Stage::Geometry; - case EShLangFragment: - return Compiler::Stage::Fragment; - case EShLangCompute: - return Compiler::Stage::Compute; - case EShLangRayGenNV: - return Compiler::Stage::RayGenNV; - case EShLangIntersectNV: - return Compiler::Stage::IntersectNV; - case EShLangAnyHitNV: - return Compiler::Stage::AnyHitNV; - case EShLangClosestHitNV: - return Compiler::Stage::ClosestHitNV; - case EShLangMissNV: - return Compiler::Stage::MissNV; - case EShLangCallableNV: - return Compiler::Stage::CallableNV; - case EShLangTaskNV: - return Compiler::Stage::TaskNV; - case EShLangMeshNV: - return Compiler::Stage::MeshNV; - default: - break; - } - assert(false && "Invalid case"); - return Compiler::Stage::Compute; -} - -// A GlslangClientInfo captures target client version and desired SPIR-V -// version. -struct GlslangClientInfo { - GlslangClientInfo() {} - GlslangClientInfo(const std::string& e, glslang::EShClient c, - glslang::EShTargetClientVersion cv, - glslang::EShTargetLanguage l, - glslang::EShTargetLanguageVersion lv) - : error(e), - client(c), - client_version(cv), - target_language(l), - target_language_version(lv) {} - - std::string error; // Empty if ok, otherwise contains the error message. - glslang::EShClient client = glslang::EShClientNone; - glslang::EShTargetClientVersion client_version; - glslang::EShTargetLanguage target_language = glslang::EShTargetSpv; - glslang::EShTargetLanguageVersion target_language_version = - glslang::EShTargetSpv_1_0; -}; - -// Returns the mappings to Glslang client, client version, and SPIR-V version. -// Also indicates whether the input values were valid. -GlslangClientInfo GetGlslangClientInfo( - const std::string& error_tag, // Indicates source location, for errors. - shaderc_util::Compiler::TargetEnv env, - shaderc_util::Compiler::TargetEnvVersion env_version, - shaderc_util::Compiler::SpirvVersion spv_version, - bool spv_version_is_forced); - -} // namespace shaderc_util -#endif // LIBSHADERC_UTIL_INC_COMPILER_H diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/counting_includer.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/counting_includer.h deleted file mode 100644 index 3e6b0a69c..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/counting_includer.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_COUNTING_INCLUDER_H -#define LIBSHADERC_UTIL_COUNTING_INCLUDER_H - -#include - -#include "glslang/Public/ShaderLang.h" - -#include "libshaderc_util/mutex.h" - -namespace shaderc_util { - -// An Includer that counts how many #include directives it saw. -// Inclusions are internally serialized, but releasing a previous result -// can occur concurrently. -class CountingIncluder : public glslang::TShader::Includer { - public: - // Done as .store(0) instead of in the initializer list for the following - // reasons: - // Clang > 3.6 will complain about it if it is written as ({0}). - // VS2013 fails if it is written as {0}. - // G++-4.8 does not correctly support std::atomic_init. - CountingIncluder() { - num_include_directives_.store(0); - } - - enum class IncludeType { - System, // Only do < > include search - Local, // Only do " " include search - }; - - // Resolves an include request for a source by name, type, and name of the - // requesting source. For the semantics of the result, see the base class. - // Also increments num_include_directives and returns the results of - // include_delegate(filename). Subclasses should override include_delegate() - // instead of this method. Inclusions are serialized. - glslang::TShader::Includer::IncludeResult* includeSystem( - const char* requested_source, const char* requesting_source, - size_t include_depth) final { - ++num_include_directives_; - include_mutex_.lock(); - auto result = include_delegate(requested_source, requesting_source, - IncludeType::System, include_depth); - include_mutex_.unlock(); - return result; - } - - // Like includeSystem, but for "local" include search. - glslang::TShader::Includer::IncludeResult* includeLocal( - const char* requested_source, const char* requesting_source, - size_t include_depth) final { - ++num_include_directives_; - include_mutex_.lock(); - auto result = include_delegate(requested_source, requesting_source, - IncludeType::Local, include_depth); - include_mutex_.unlock(); - return result; - } - - // Releases the given IncludeResult. - void releaseInclude(glslang::TShader::Includer::IncludeResult* result) final { - release_delegate(result); - } - - int num_include_directives() const { return num_include_directives_.load(); } - - private: - - // Invoked by this class to provide results to - // glslang::TShader::Includer::include. - virtual glslang::TShader::Includer::IncludeResult* include_delegate( - const char* requested_source, const char* requesting_source, - IncludeType type, size_t include_depth) = 0; - - // Release the given IncludeResult. - virtual void release_delegate( - glslang::TShader::Includer::IncludeResult* result) = 0; - - // The number of #include directive encountered. - std::atomic_int num_include_directives_; - - // A mutex to protect against concurrent inclusions. We can't trust - // our delegates to be safe for concurrent inclusions. - shaderc_util::mutex include_mutex_; -}; -} - -#endif // LIBSHADERC_UTIL_COUNTING_INCLUDER_H diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/exceptions.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/exceptions.h deleted file mode 100644 index 93a03aa26..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/exceptions.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_EXCEPTIONS_H_ -#define LIBSHADERC_UTIL_EXCEPTIONS_H_ - -#if (defined(_MSC_VER) && !defined(_CPPUNWIND)) || !defined(__EXCEPTIONS) -#define TRY_IF_EXCEPTIONS_ENABLED -#define CATCH_IF_EXCEPTIONS_ENABLED(X) if (0) -#else -#define TRY_IF_EXCEPTIONS_ENABLED try -#define CATCH_IF_EXCEPTIONS_ENABLED(X) catch (X) -#endif - -#endif // LIBSHADERC_UTIL_EXCEPTIONS_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/file_finder.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/file_finder.h deleted file mode 100644 index a5f91cf6e..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/file_finder.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_SRC_FILE_FINDER_H_ -#define LIBSHADERC_UTIL_SRC_FILE_FINDER_H_ - -#include -#include - -namespace shaderc_util { - -// Finds files within a search path. -class FileFinder { - public: - // Searches for a read-openable file based on filename, which must be - // non-empty. The search is attempted on filename prefixed by each element of - // search_path() in turn. The first hit is returned, or an empty string if - // there are no hits. Search attempts treat their argument the way - // std::fopen() treats its filename argument, ignoring whether the path is - // absolute or relative. - // - // If a search_path() element is non-empty and not ending in a slash, then a - // slash is inserted between it and filename before its search attempt. An - // empty string in search_path() means that the filename is tried as-is. - std::string FindReadableFilepath(const std::string& filename) const; - - // Searches for a read-openable file based on filename, which must be - // non-empty. The search is first attempted as a path relative to - // the requesting_file parameter. If no file is found relative to the - // requesting_file then this acts as FindReadableFilepath does. If - // requesting_file does not contain a '/' or a '\' character then it is - // assumed to be a filename and the request will be relative to the - // current directory. - std::string FindRelativeReadableFilepath(const std::string& requesting_file, - const std::string& filename) const; - - // Search path for Find(). Users may add/remove elements as desired. - std::vector& search_path() { return search_path_; } - - private: - std::vector search_path_; -}; - -} // namespace shaderc_util - -#endif // LIBSHADERC_UTIL_SRC_FILE_FINDER_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/format.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/format.h deleted file mode 100644 index 182f05027..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/format.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_FORMAT_H_ -#define LIBSHADERC_UTIL_FORMAT_H_ - -#include - -namespace shaderc_util { - -// Returns a string containing for every -// key-value entry in map. -template -std::string format(const Map& map, const std::string& prefix, - const std::string& infix, const std::string& postfix) { - std::stringstream s; - for (const auto& pair : map) { - s << prefix << pair.first << infix << pair.second << postfix; - } - return s.str(); -} - -} // namespace shaderc_util - -#endif // LIBSHADERC_UTIL_FORMAT_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/io_shaderc.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/io_shaderc.h deleted file mode 100644 index b9116c11e..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/io_shaderc.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_IO_H_ -#define LIBSHADERC_UTIL_IO_H_ - -#include -#include - -#include "string_piece.h" - -namespace shaderc_util { - -// Returns true if the given path is an absolute path. -bool IsAbsolutePath(const std::string& path); - -// A helper function to return the base file name from either absolute path or -// relative path representation of a file. It keeps the component from the last -// '/' or '\' to the end of the given string. If the component is '..' or '.', -// returns an empty string. If '/' or '\' is the last char of the given string, -// also returns an empty string. -// e.g.: dir_a/dir_b/file_c.vert => file_c.vert -// dir_a/dir_b/.. => -// dir_a/dir_b/. => -// dir_a/dirb/c/ => -// Note that this method doesn't check whether the given path is a valid one or -// not. -std::string GetBaseFileName(const std::string& file_path); - -// Reads all of the characters in a given file into input_data. Outputs an -// error message to std::cerr if the file could not be read and returns false if -// there was an error. If the input_file is "-", then input is read from -// std::cin. -bool ReadFile(const std::string& input_file_name, - std::vector* input_data); - -// Returns and initializes the file_stream parameter if the output_filename -// refers to a file, or returns &std::cout if the output_filename is "-". -// Returns nullptr and emits an error message to err if the file could -// not be opened for writing. If the output refers to a file, and the open -// failed for writing, file_stream is left with its fail_bit set. -std::ostream* GetOutputStream(const string_piece& output_filename, - std::ofstream* file_stream, std::ostream* err); - -// Writes output_data to a file, overwriting if it exists. If output_file_name -// is "-", writes to std::cout. -bool WriteFile(std::ostream* output_stream, const string_piece& output_data); - -// Flush the standard output stream and set it to binary mode. Subsequent -// output will not translate newlines to carriage-return newline pairs. -void FlushAndSetBinaryModeOnStdout(); -// Flush the standard output stream and set it to text mode. Subsequent -// output will translate newlines to carriage-return newline pairs. -void FlushAndSetTextModeOnStdout(); - -} // namespace shaderc_util - -#endif // LIBSHADERC_UTIL_IO_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/message.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/message.h deleted file mode 100644 index 8a7779075..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/message.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_SRC_MESSAGE_H_ -#define LIBSHADERC_UTIL_SRC_MESSAGE_H_ - -#include "libshaderc_util/string_piece.h" - -namespace shaderc_util { - -// TODO(antiagainst): document the differences of the following message types. -enum class MessageType { - Warning, - Error, - ErrorSummary, - WarningSummary, - GlobalWarning, - GlobalError, - Unknown, - Ignored -}; - -// Given a glslang warning/error message, processes it in the following way and -// returns its message type. -// -// * Places the source name into the source_name parameter, if found. -// Otherwise, clears the source_name parameter. -// * Places the line number into the line_number parameter, if found. -// Otherwise, clears the line_number parameter. -// * Places the rest of the message (the text past warning/error prefix, source -// name, and line number) into the rest parameter. -// -// If warnings_as_errors is set to true, then all warnings will be treated as -// errors. -// If suppress_warnings is set to true, then no warnings will be emitted. This -// takes precedence over warnings_as_errors. -// -// Examples: -// "ERROR: 0:2: Message" -// source_name="0", line_number="2", rest="Message" -// "Warning, Message" -// source_name="", line_number="", rest="Message" -// "ERROR: 2 errors found." -// source_name="2", line_number="", rest="errors found". -// -// Note that filenames can contain colons: -// "ERROR: foo:bar.comp.hlsl:2: 'a' : unknown variable" -MessageType ParseGlslangOutput(const shaderc_util::string_piece& message, - bool warnings_as_errors, bool suppress_warnings, - shaderc_util::string_piece* source_name, - shaderc_util::string_piece* line_number, - shaderc_util::string_piece* rest); - -// Filters error_messages received from glslang, and outputs, to error_stream, -// any that are not ignored in a clang like format. If the warnings_as_errors -// boolean is set, then all warnings will be treated as errors. If the -// suppress_warnings boolean is set then any warning messages are ignored. This -// takes precedence over warnings_as_errors. Increments total_warnings and -// total_errors based on the message types. -// Returns true if no new errors were found when parsing the messages. -// "" will substitute "-1" appearing at the string name/number -// segment. -bool PrintFilteredErrors(const shaderc_util::string_piece& file_name, - std::ostream* error_stream, bool warnings_as_errors, - bool suppress_warnings, const char* error_list, - size_t* total_warnings, size_t* total_errors); - -// Outputs, to error_stream, the number of warnings and errors if there are -// any. -void OutputMessages(std::ostream* error_stream, size_t total_warnings, - size_t total_errors); - -} // namespace glslc - -#endif // LIBSHADERC_UTIL_SRC_MESSAGE_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/mutex.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/mutex.h deleted file mode 100644 index 4147cac2a..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/mutex.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_INC_MUTEX_H -#define LIBSHADERC_UTIL_INC_MUTEX_H - -// shaderc_util::mutex will be defined and specialized -// depending on the platform that is being compiled. -// It is more or less conformant to the C++11 specification of std::mutex. -// However it does not implement try_lock. - -#ifdef _WIN32 -// windows.h #defines min and max if we don't define this. -// this means things like std::min and std::max break -#ifndef NOMINMAX -#define NOMINMAX -#endif - -#include -namespace shaderc_util { - -// As the name suggests, this mutex class is for running on windows. -// It conforms to the c++11 mutex implementation, and should be a -// drop in replacement. -class windows_mutex { - public: - using native_handle_type = HANDLE; - - windows_mutex() { mutex_ = CreateMutex(nullptr, false, nullptr); } - - ~windows_mutex() { - if (mutex_ != INVALID_HANDLE_VALUE) { - CloseHandle(mutex_); - } - } - - windows_mutex(const windows_mutex&) = delete; - windows_mutex& operator=(const windows_mutex&) = delete; - - // Locks this mutex, waiting until the mutex is unlocked if it is not already. - // It is not valid to lock a mutex that has already been locked. - void lock() { WaitForSingleObject(mutex_, INFINITE); } - - // Unlocks this mutex. It is invalid to unlock a mutex that this thread - // has not already locked. - void unlock() { ReleaseMutex(mutex_); } - - // Returns the native handle for this mutex. In this case a HANDLE object. - native_handle_type native_handle() { return mutex_; } - - private: - HANDLE mutex_; -}; - -using mutex = windows_mutex; -} - -#else -#include -#include -namespace shaderc_util { - -// As the name suggests, this mutex class is for running with pthreads. -// It conforms to the c++11 mutex implementation, and should be a -// drop in replacement. -class posix_mutex { - public: - using native_handle_type = pthread_mutex_t*; - - posix_mutex() { pthread_mutex_init(&mutex_, nullptr); } - - ~posix_mutex() { pthread_mutex_destroy(&mutex_); } - - posix_mutex(const posix_mutex&) = delete; - posix_mutex& operator=(const posix_mutex&) = delete; - - // Locks this mutex, waiting until the mutex is unlocked if it is not already. - // It is not valid to lock a mutex that has already been locked. - void lock() { pthread_mutex_lock(&mutex_); } - - // Unlocks this mutex. It is invalid to unlock a mutex that this thread - // has not already locked. - void unlock() { pthread_mutex_unlock(&mutex_); } - - // Returns the native handle for this mutex. In this case a pthread_mutex_t*. - native_handle_type native_handle() { return &mutex_; } - - private: - pthread_mutex_t mutex_; -}; - -using mutex = posix_mutex; -} -#endif - -#endif // LIBSHADERC_UTIL_INC_MUTEX_H diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/resources.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/resources.h deleted file mode 100644 index a8f635b26..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/resources.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_RESOURCES_H_ -#define LIBSHADERC_UTIL_RESOURCES_H_ - -// We want TBuiltInResource -#include "glslang/Include/ResourceLimits.h" - -namespace shaderc_util { - -using TBuiltInResource = ::TBuiltInResource; - -// A set of suitable defaults. -extern const TBuiltInResource kDefaultTBuiltInResource; - -} // namespace shaderc_util - -#endif // LIBSHADERC_UTIL_RESOURCES_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/resources.inc b/lib/shaderc/libshaderc_util/include/libshaderc_util/resources.inc deleted file mode 100644 index 8e86f015f..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/resources.inc +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2016 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// These are the resource limits in a glslang::TBuiltInResource. -// The first field is the string name to be used in a configuration setting. -// The second field is the fieldname in TBuiltInResource. -// The third field is the enum name fragment for shaderc_limit. -// -// TODO(dneto): Consider using a single list of names, but use a Python script -// to generate *this* file. The original data file would have the first field, -// then generate the second field by lowering the case of the first letter, and -// generate the third field by taking the second field, and converting a -// lower-to-upper case transition into an underscore with lower-case. -RESOURCE(MaxLights,maxLights,max_lights) -RESOURCE(MaxClipPlanes,maxClipPlanes,max_clip_planes) -RESOURCE(MaxTextureUnits,maxTextureUnits,max_texture_units) -RESOURCE(MaxTextureCoords,maxTextureCoords,max_texture_coords) -RESOURCE(MaxVertexAttribs,maxVertexAttribs,max_vertex_attribs) -RESOURCE(MaxVertexUniformComponents,maxVertexUniformComponents,max_vertex_uniform_components) -RESOURCE(MaxVaryingFloats,maxVaryingFloats,max_varying_floats) -RESOURCE(MaxVertexTextureImageUnits,maxVertexTextureImageUnits,max_vertex_texture_image_units) -RESOURCE(MaxCombinedTextureImageUnits,maxCombinedTextureImageUnits,max_combined_texture_image_units) -RESOURCE(MaxTextureImageUnits,maxTextureImageUnits,max_texture_image_units) -RESOURCE(MaxFragmentUniformComponents,maxFragmentUniformComponents,max_fragment_uniform_components) -RESOURCE(MaxDrawBuffers,maxDrawBuffers,max_draw_buffers) -RESOURCE(MaxVertexUniformVectors,maxVertexUniformVectors,max_vertex_uniform_vectors) -RESOURCE(MaxVaryingVectors,maxVaryingVectors,max_varying_vectors) -RESOURCE(MaxFragmentUniformVectors,maxFragmentUniformVectors,max_fragment_uniform_vectors) -RESOURCE(MaxVertexOutputVectors,maxVertexOutputVectors,max_vertex_output_vectors) -RESOURCE(MaxFragmentInputVectors,maxFragmentInputVectors,max_fragment_input_vectors) -RESOURCE(MinProgramTexelOffset,minProgramTexelOffset,min_program_texel_offset) -RESOURCE(MaxProgramTexelOffset,maxProgramTexelOffset,max_program_texel_offset) -RESOURCE(MaxClipDistances,maxClipDistances,max_clip_distances) -RESOURCE(MaxComputeWorkGroupCountX,maxComputeWorkGroupCountX,max_compute_work_group_count_x) -RESOURCE(MaxComputeWorkGroupCountY,maxComputeWorkGroupCountY,max_compute_work_group_count_y) -RESOURCE(MaxComputeWorkGroupCountZ,maxComputeWorkGroupCountZ,max_compute_work_group_count_z) -RESOURCE(MaxComputeWorkGroupSizeX,maxComputeWorkGroupSizeX,max_compute_work_group_size_x) -RESOURCE(MaxComputeWorkGroupSizeY,maxComputeWorkGroupSizeY,max_compute_work_group_size_y) -RESOURCE(MaxComputeWorkGroupSizeZ,maxComputeWorkGroupSizeZ,max_compute_work_group_size_z) -RESOURCE(MaxComputeUniformComponents,maxComputeUniformComponents,max_compute_uniform_components) -RESOURCE(MaxComputeTextureImageUnits,maxComputeTextureImageUnits,max_compute_texture_image_units) -RESOURCE(MaxComputeImageUniforms,maxComputeImageUniforms,max_compute_image_uniforms) -RESOURCE(MaxComputeAtomicCounters,maxComputeAtomicCounters,max_compute_atomic_counters) -RESOURCE(MaxComputeAtomicCounterBuffers,maxComputeAtomicCounterBuffers,max_compute_atomic_counter_buffers) -RESOURCE(MaxVaryingComponents,maxVaryingComponents,max_varying_components) -RESOURCE(MaxVertexOutputComponents,maxVertexOutputComponents,max_vertex_output_components) -RESOURCE(MaxGeometryInputComponents,maxGeometryInputComponents,max_geometry_input_components) -RESOURCE(MaxGeometryOutputComponents,maxGeometryOutputComponents,max_geometry_output_components) -RESOURCE(MaxFragmentInputComponents,maxFragmentInputComponents,max_fragment_input_components) -RESOURCE(MaxImageUnits,maxImageUnits,max_image_units) -RESOURCE(MaxCombinedImageUnitsAndFragmentOutputs,maxCombinedImageUnitsAndFragmentOutputs,max_combined_image_units_and_fragment_outputs) -RESOURCE(MaxCombinedShaderOutputResources,maxCombinedShaderOutputResources,max_combined_shader_output_resources) -RESOURCE(MaxImageSamples,maxImageSamples,max_image_samples) -RESOURCE(MaxVertexImageUniforms,maxVertexImageUniforms,max_vertex_image_uniforms) -RESOURCE(MaxTessControlImageUniforms,maxTessControlImageUniforms,max_tess_control_image_uniforms) -RESOURCE(MaxTessEvaluationImageUniforms,maxTessEvaluationImageUniforms,max_tess_evaluation_image_uniforms) -RESOURCE(MaxGeometryImageUniforms,maxGeometryImageUniforms,max_geometry_image_uniforms) -RESOURCE(MaxFragmentImageUniforms,maxFragmentImageUniforms,max_fragment_image_uniforms) -RESOURCE(MaxCombinedImageUniforms,maxCombinedImageUniforms,max_combined_image_uniforms) -RESOURCE(MaxGeometryTextureImageUnits,maxGeometryTextureImageUnits,max_geometry_texture_image_units) -RESOURCE(MaxGeometryOutputVertices,maxGeometryOutputVertices,max_geometry_output_vertices) -RESOURCE(MaxGeometryTotalOutputComponents,maxGeometryTotalOutputComponents,max_geometry_total_output_components) -RESOURCE(MaxGeometryUniformComponents,maxGeometryUniformComponents,max_geometry_uniform_components) -RESOURCE(MaxGeometryVaryingComponents,maxGeometryVaryingComponents,max_geometry_varying_components) -RESOURCE(MaxTessControlInputComponents,maxTessControlInputComponents,max_tess_control_input_components) -RESOURCE(MaxTessControlOutputComponents,maxTessControlOutputComponents,max_tess_control_output_components) -RESOURCE(MaxTessControlTextureImageUnits,maxTessControlTextureImageUnits,max_tess_control_texture_image_units) -RESOURCE(MaxTessControlUniformComponents,maxTessControlUniformComponents,max_tess_control_uniform_components) -RESOURCE(MaxTessControlTotalOutputComponents,maxTessControlTotalOutputComponents,max_tess_control_total_output_components) -RESOURCE(MaxTessEvaluationInputComponents,maxTessEvaluationInputComponents,max_tess_evaluation_input_components) -RESOURCE(MaxTessEvaluationOutputComponents,maxTessEvaluationOutputComponents,max_tess_evaluation_output_components) -RESOURCE(MaxTessEvaluationTextureImageUnits,maxTessEvaluationTextureImageUnits,max_tess_evaluation_texture_image_units) -RESOURCE(MaxTessEvaluationUniformComponents,maxTessEvaluationUniformComponents,max_tess_evaluation_uniform_components) -RESOURCE(MaxTessPatchComponents,maxTessPatchComponents,max_tess_patch_components) -RESOURCE(MaxPatchVertices,maxPatchVertices,max_patch_vertices) -RESOURCE(MaxTessGenLevel,maxTessGenLevel,max_tess_gen_level) -RESOURCE(MaxViewports,maxViewports,max_viewports) -RESOURCE(MaxVertexAtomicCounters,maxVertexAtomicCounters,max_vertex_atomic_counters) -RESOURCE(MaxTessControlAtomicCounters,maxTessControlAtomicCounters,max_tess_control_atomic_counters) -RESOURCE(MaxTessEvaluationAtomicCounters,maxTessEvaluationAtomicCounters,max_tess_evaluation_atomic_counters) -RESOURCE(MaxGeometryAtomicCounters,maxGeometryAtomicCounters,max_geometry_atomic_counters) -RESOURCE(MaxFragmentAtomicCounters,maxFragmentAtomicCounters,max_fragment_atomic_counters) -RESOURCE(MaxCombinedAtomicCounters,maxCombinedAtomicCounters,max_combined_atomic_counters) -RESOURCE(MaxAtomicCounterBindings,maxAtomicCounterBindings,max_atomic_counter_bindings) -RESOURCE(MaxVertexAtomicCounterBuffers,maxVertexAtomicCounterBuffers,max_vertex_atomic_counter_buffers) -RESOURCE(MaxTessControlAtomicCounterBuffers,maxTessControlAtomicCounterBuffers,max_tess_control_atomic_counter_buffers) -RESOURCE(MaxTessEvaluationAtomicCounterBuffers,maxTessEvaluationAtomicCounterBuffers,max_tess_evaluation_atomic_counter_buffers) -RESOURCE(MaxGeometryAtomicCounterBuffers,maxGeometryAtomicCounterBuffers,max_geometry_atomic_counter_buffers) -RESOURCE(MaxFragmentAtomicCounterBuffers,maxFragmentAtomicCounterBuffers,max_fragment_atomic_counter_buffers) -RESOURCE(MaxCombinedAtomicCounterBuffers,maxCombinedAtomicCounterBuffers,max_combined_atomic_counter_buffers) -RESOURCE(MaxAtomicCounterBufferSize,maxAtomicCounterBufferSize,max_atomic_counter_buffer_size) -RESOURCE(MaxTransformFeedbackBuffers,maxTransformFeedbackBuffers,max_transform_feedback_buffers) -RESOURCE(MaxTransformFeedbackInterleavedComponents,maxTransformFeedbackInterleavedComponents,max_transform_feedback_interleaved_components) -RESOURCE(MaxCullDistances,maxCullDistances,max_cull_distances) -RESOURCE(MaxCombinedClipAndCullDistances,maxCombinedClipAndCullDistances,max_combined_clip_and_cull_distances) -RESOURCE(MaxSamples,maxSamples,max_samples) diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/shader_stage.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/shader_stage.h deleted file mode 100644 index a939cb22a..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/shader_stage.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_SHADER_STAGE_H_ -#define LIBSHADERC_UTIL_SHADER_STAGE_H_ - -#include -#include -#include -#include - -#include "glslang/Public/ShaderLang.h" - -#include "libshaderc_util/string_piece.h" - -namespace shaderc_util { - -// Given a string representing a stage, returns the glslang EShLanguage for it. -// If the stage string is not recognized, returns EShLangCount. -EShLanguage MapStageNameToLanguage( - const shaderc_util::string_piece& stage_name); - -} // namespace shaderc_util - -#endif // LIBSHADERC_UTIL_SHADER_STAGE_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h deleted file mode 100644 index 09d846273..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2016 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_INC_SPIRV_TOOLS_WRAPPER_H -#define LIBSHADERC_UTIL_INC_SPIRV_TOOLS_WRAPPER_H - -#include -#include - -#include "spirv-tools/libspirv.hpp" - -#include "libshaderc_util/compiler.h" -#include "libshaderc_util/string_piece.h" - -namespace shaderc_util { -// Assembles the given assembly. On success, returns true, writes the assembled -// binary to *binary, and clears *errors. Otherwise, writes the error message -// into *errors. -bool SpirvToolsAssemble(Compiler::TargetEnv env, - Compiler::TargetEnvVersion version, - const string_piece assembly, spv_binary* binary, - std::string* errors); - -// Disassembles the given binary. Returns true and writes the disassembled text -// to *text_or_error if successful. Otherwise, writes the error message to -// *text_or_error. -bool SpirvToolsDisassemble(Compiler::TargetEnv env, - Compiler::TargetEnvVersion version, - const std::vector& binary, - std::string* text_or_error); - -// The ids of a list of supported optimization passes. -enum class PassId { - // SPIRV-Tools standard recipes - kLegalizationPasses, - kPerformancePasses, - kSizePasses, - - // SPIRV-Tools specific passes - kNullPass, - kStripDebugInfo, - kCompactIds, -}; - -// Optimizes the given binary. Passes are registered in the exact order as shown -// in enabled_passes, without de-duplication. Returns true and writes the -// optimized binary back to *binary if successful. Otherwise, writes errors to -// *errors and the content of binary may be in an invalid state. -bool SpirvToolsOptimize(Compiler::TargetEnv env, - Compiler::TargetEnvVersion version, - const std::vector& enabled_passes, - std::vector* binary, std::string* errors); - -} // namespace shaderc_util - -#endif // LIBSHADERC_UTIL_INC_SPIRV_TOOLS_WRAPPER_H diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/string_piece.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/string_piece.h deleted file mode 100644 index 89049d9e6..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/string_piece.h +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_STRING_PIECE_H_ -#define LIBSHADERC_UTIL_STRING_PIECE_H_ - -#include -#include -#include -#include - -namespace shaderc_util { -// Provides a read-only view into a string (cstring or std::string). -// This must be created after the string in question, and cannot -// outlive the memory of the string in question. -// Any operations that may modify the location or size of the -// original data render the associated string_piece invalid. - -class string_piece { - public: - typedef const char* iterator; - static const size_t npos = -1; - - string_piece() {} - - string_piece(const char* begin, const char* end) : begin_(begin), end_(end) { - assert((begin == nullptr) == (end == nullptr) && - "either both begin and end must be nullptr or neither must be"); - } - - string_piece(const char* string) : begin_(string), end_(string) { - if (string) { - end_ += strlen(string); - } - } - - string_piece(const std::string& str) { - if (!str.empty()) { - begin_ = &(str.front()); - end_ = &(str.back()) + 1; - } - } - - string_piece(const string_piece& other) { - begin_ = other.begin_; - end_ = other.end_; - } - - string_piece& operator=(const string_piece& other) = default; - - // Clears the string_piece removing any reference to the original string. - void clear() { - begin_ = nullptr; - end_ = nullptr; - } - - // Returns a pointer to the data contained in the underlying string. - // If there is no underlying string, returns a nullptr. - const char* data() const { return begin_; } - - // Returns an std::string copy of the internal data. - std::string str() const { return std::string(begin_, end_); } - - // Returns a string_piece that points to a substring in the original string. - string_piece substr(size_t pos, size_t len = npos) const { - assert(len == npos || pos + len <= size()); - return string_piece(begin_ + pos, len == npos ? end_ : begin_ + pos + len); - } - - // Takes any function object predicate that takes a char and returns a - // boolean. - // Returns the index of the first element that does not return true for the - // predicate. - // Returns string_piece::npos if all elements match. - template - size_t find_first_not_matching(T callee) { - for (auto it = begin_; it != end_; ++it) { - if (!callee(*it)) { - return it - begin_; - } - } - return npos; - } - - // Returns the index of the first character that does not match any character - // in the input string_piece. - // The search only includes characters at or after position pos. - // Returns string_piece::npos if all match. - size_t find_first_not_of(const string_piece& to_search, - size_t pos = 0) const { - if (pos >= size()) { - return npos; - } - for (auto it = begin_ + pos; it != end_; ++it) { - if (to_search.find_first_of(*it) == npos) { - return it - begin_; - } - } - return npos; - } - - // Returns find_first_not_of(str, pos) where str is a string_piece - // containing only to_search. - size_t find_first_not_of(char to_search, size_t pos = 0) const { - return find_first_not_of(string_piece(&to_search, &to_search + 1), pos); - } - - // Returns the index of the first character that matches any character in the - // input string_piece. - // The search only includes characters at or after position pos. - // Returns string_piece::npos if there is no match. - size_t find_first_of(const string_piece& to_search, size_t pos = 0) const { - if (pos >= size()) { - return npos; - } - for (auto it = begin_ + pos; it != end_; ++it) { - for (char c : to_search) { - if (c == *it) { - return it - begin_; - } - } - } - return npos; - } - - // Returns find_first_of(str, pos) where str is a string_piece - // containing only to_search. - size_t find_first_of(char to_search, size_t pos = 0) const { - return find_first_of(string_piece(&to_search, &to_search + 1), pos); - } - - // Returns the index of the last character that matches any character in the - // input string_piece. - // The search only includes characters at or before position pos. - // Returns string_piece::npos if there is no match. - size_t find_last_of(const string_piece& to_search, size_t pos = npos) const { - if (empty()) return npos; - if (pos >= size()) { - pos = size(); - } - auto it = begin_ + pos + 1; - do { - --it; - if (to_search.find_first_of(*it) != npos) { - return it - begin_; - } - } while (it != begin_); - return npos; - } - - // Returns find_last_of(str, pos) where str is a string_piece - // containing only to_search. - size_t find_last_of(char to_search, size_t pos = npos) const { - return find_last_of(string_piece(&to_search, &to_search + 1), pos); - } - - // Returns the index of the last character that does not match any character - // in the input string_piece. - // The search only includes characters at or before position pos. - // Returns string_piece::npos if there is no match. - size_t find_last_not_of(const string_piece& to_search, - size_t pos = npos) const { - if (empty()) return npos; - if (pos >= size()) { - pos = size(); - } - auto it = begin_ + pos + 1; - do { - --it; - if (to_search.find_first_of(*it) == npos) { - return it - begin_; - } - } while (it != begin_); - return npos; - } - - // Returns find_last_not_of(str, pos) where str is a string_piece - // containing only to_search. - size_t find_last_not_of(char to_search, size_t pos = 0) const { - return find_last_not_of(string_piece(&to_search, &to_search + 1), pos); - } - - // Continuously removes characters appearing in chars_to_strip from the left. - string_piece lstrip(const string_piece& chars_to_strip) const { - iterator begin = begin_; - for (; begin < end_; ++begin) - if (chars_to_strip.find_first_of(*begin) == npos) break; - if (begin >= end_) return string_piece(); - return string_piece(begin, end_); - } - - // Continuously removes characters appearing in chars_to_strip from the right. - string_piece rstrip(const string_piece& chars_to_strip) const { - iterator end = end_; - for (; begin_ < end; --end) - if (chars_to_strip.find_first_of(*(end - 1)) == npos) break; - if (begin_ >= end) return string_piece(); - return string_piece(begin_, end); - } - - // Continuously removes characters appearing in chars_to_strip from both - // sides. - string_piece strip(const string_piece& chars_to_strip) const { - return lstrip(chars_to_strip).rstrip(chars_to_strip); - } - - string_piece strip_whitespace() const { return strip(" \t\n\r\f\v"); } - - // Returns the character at index i in the string_piece. - const char& operator[](size_t i) const { return *(begin_ + i); } - - // Standard comparison operator. - bool operator==(const string_piece& other) const { - // Either end_ and _begin_ are nullptr or neither of them are. - assert(((end_ == nullptr) == (begin_ == nullptr))); - assert(((other.end_ == nullptr) == (other.begin_ == nullptr))); - if (size() != other.size()) { - return false; - } - return (memcmp(begin_, other.begin_, end_ - begin_) == 0); - } - - bool operator!=(const string_piece& other) const { - return !operator==(other); - } - - // Returns an iterator to the first element. - iterator begin() const { return begin_; } - - // Returns an iterator to one past the last element. - iterator end() const { return end_; } - - const char& front() const { - assert(!empty()); - return *begin_; - } - - const char& back() const { - assert(!empty()); - return *(end_ - 1); - } - - // Returns true is this string_piece starts with the same - // characters as other. - bool starts_with(const string_piece& other) const { - const char* iter = begin_; - const char* other_iter = other.begin(); - while (iter != end_ && other_iter != other.end()) { - if (*iter++ != *other_iter++) { - return false; - } - } - return other_iter == other.end(); - } - - // Returns the index of the start of the first substring that matches - // the input string_piece. - // The search only includes substrings starting at or after position pos. - // Returns npos if the string cannot be found. - size_t find(const string_piece& substr, size_t pos = 0) const { - if (empty()) return npos; - if (pos >= size()) return npos; - if (substr.empty()) return 0; - for (auto it = begin_ + pos; - end() - it >= static_cast(substr.size()); ++it) { - if (string_piece(it, end()).starts_with(substr)) return it - begin_; - } - return npos; - } - - // Returns the index of the start of the first character that matches - // the input character. - // The search only includes substrings starting at or after position pos. - // Returns npos if the character cannot be found. - size_t find(char character, size_t pos = 0) const { - return find_first_of(character, pos); - } - - // Returns true if the string_piece is empty. - bool empty() const { return begin_ == end_; } - - // Returns the number of characters in the string_piece. - size_t size() const { return end_ - begin_; } - - // Returns a vector of string_pieces representing delimiter delimited - // fields found. If the keep_delimiter parameter is true, then each - // delimiter character is kept with the string to its left. - std::vector get_fields(char delimiter, - bool keep_delimiter = false) const { - std::vector fields; - size_t first = 0; - size_t field_break = find_first_of(delimiter); - while (field_break != npos) { - fields.push_back(substr(first, field_break - first + keep_delimiter)); - first = field_break + 1; - field_break = find_first_of(delimiter, first); - } - if (size() - first > 0) { - fields.push_back(substr(first, size() - first)); - } - return fields; - } - - friend std::ostream& operator<<(std::ostream& os, const string_piece& piece); - - private: - // It is expected that begin_ and end_ will both be null or - // they will both point to valid pieces of memory, but it is invalid - // to have one of them being nullptr and the other not. - string_piece::iterator begin_ = nullptr; - string_piece::iterator end_ = nullptr; -}; - -inline std::ostream& operator<<(std::ostream& os, const string_piece& piece) { - // Either end_ and _begin_ are nullptr or neither of them are. - assert(((piece.end_ == nullptr) == (piece.begin_ == nullptr))); - if (piece.end_ != piece.begin_) { - os.write(piece.begin_, piece.end_ - piece.begin_); - } - return os; -} - -inline bool operator==(const char* first, const string_piece second) { - return second == first; -} - -inline bool operator!=(const char* first, const string_piece second) { - return !operator==(first, second); -} -} - -namespace std { -template <> -struct hash { - size_t operator()(const shaderc_util::string_piece& piece) const { - // djb2 algorithm. - size_t hash = 5381; - for (char c : piece) { - hash = ((hash << 5) + hash) + c; - } - return hash; - } -}; -} - -#endif // LIBSHADERC_UTIL_STRING_PIECE_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/universal_unistd.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/universal_unistd.h deleted file mode 100644 index 9f6e74fa4..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/universal_unistd.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_UNIVERSAL_UNISTD_H_ -#define LIBSHADERC_UTIL_UNIVERSAL_UNISTD_H_ - -#ifndef _MSC_VER -#include -#else -// Minimal set of needed to compile on windows. - -#include -#define access _access - -// https://msdn.microsoft.com/en-us/library/1w06ktdy.aspx -// Defines these constants. -#define R_OK 4 -#define W_OK 2 -#endif //_MSC_VER - -#endif // LIBSHADERC_UTIL_UNIVERSAL_UNISTD_H_ diff --git a/lib/shaderc/libshaderc_util/include/libshaderc_util/version_profile.h b/lib/shaderc/libshaderc_util/include/libshaderc_util/version_profile.h deleted file mode 100644 index f536b300e..000000000 --- a/lib/shaderc/libshaderc_util/include/libshaderc_util/version_profile.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_INC_VERSION_PROFILE_H_ -#define LIBSHADERC_UTIL_INC_VERSION_PROFILE_H_ - -#include - -#include "glslang/MachineIndependent/Versions.h" - -namespace shaderc_util { - -// Returns true if the given version is an accepted GLSL (ES) version. -inline bool IsKnownVersion(int version) { - switch (version) { - case 100: - case 110: - case 120: - case 130: - case 140: - case 150: - case 300: - case 310: - case 320: - case 330: - case 400: - case 410: - case 420: - case 430: - case 440: - case 450: - case 460: - return true; - default: - break; - } - return false; -} - -// Given a string version_profile containing both version and profile, decodes -// it and puts the decoded version in version, decoded profile in profile. -// Returns true if decoding is successful and version and profile are accepted. -// This does not validate the version number against the profile. For example, -// "460es" doesn't make sense (yet), but is still accepted. -bool ParseVersionProfile(const std::string& version_profile, int* version, - EProfile* profile); - -} // namespace shaderc_util - -#endif // LIBSHADERC_UTIL_INC_VERSION_PROFILE_H_ diff --git a/lib/shaderc/libshaderc_util/src/args.cc b/lib/shaderc/libshaderc_util/src/args.cc deleted file mode 100644 index f1b36e7ae..000000000 --- a/lib/shaderc/libshaderc_util/src/args.cc +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2019 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/args.h" - -#include -#include - -namespace shaderc_util { - -bool GetOptionArgument(int argc, char** argv, int* index, - const std::string& option, - string_piece* option_argument) { - const string_piece arg = argv[*index]; - assert(arg.starts_with(option)); - if (arg.size() != option.size()) { - *option_argument = arg.substr(option.size()); - return true; - } - - if (option.back() == '=') { - *option_argument = ""; - return true; - } - - if (++(*index) >= argc) return false; - *option_argument = argv[*index]; - return true; -} - -bool ParseUint32(const std::string& str, uint32_t* value) { - std::istringstream iss(str); - - iss >> std::setbase(0); - iss >> *value; - - // We should have read something. - bool ok = !str.empty() && !iss.bad(); - // It should have been all the text. - ok = ok && iss.eof(); - // It should have been in range. - ok = ok && !iss.fail(); - - // Work around a bugs in various C++ standard libraries. - // Count any negative number as an error, including "-0". - ok = ok && (str[0] != '-'); - - return ok; -} - -} // namespace shaderc_util diff --git a/lib/shaderc/libshaderc_util/src/compiler.cc b/lib/shaderc/libshaderc_util/src/compiler.cc deleted file mode 100644 index 7c1206c0d..000000000 --- a/lib/shaderc/libshaderc_util/src/compiler.cc +++ /dev/null @@ -1,785 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/compiler.h" - -#include -#include -#include -#include -#include - -#include "SPIRV/GlslangToSpv.h" -#include "libshaderc_util/format.h" -#include "libshaderc_util/io_shaderc.h" -#include "libshaderc_util/message.h" -#include "libshaderc_util/resources.h" -#include "libshaderc_util/shader_stage.h" -#include "libshaderc_util/spirv_tools_wrapper.h" -#include "libshaderc_util/string_piece.h" -#include "libshaderc_util/version_profile.h" - -namespace { -using shaderc_util::string_piece; - -// For use with glslang parsing calls. -const bool kNotForwardCompatible = false; - -// Returns true if #line directive sets the line number for the next line in the -// given version and profile. -inline bool LineDirectiveIsForNextLine(int version, EProfile profile) { - return profile == EEsProfile || version >= 330; -} - -// Returns a #line directive whose arguments are line and filename. -inline std::string GetLineDirective(int line, const string_piece& filename) { - return "#line " + std::to_string(line) + " \"" + filename.str() + "\"\n"; -} - -// Given a canonicalized #line directive (starting exactly with "#line", using -// single spaces to separate different components, and having an optional -// newline at the end), returns the line number and string name/number. If no -// string name/number is provided, the second element in the returned pair is an -// empty string_piece. Behavior is undefined if the directive parameter is not a -// canonicalized #line directive. -std::pair DecodeLineDirective(string_piece directive) { - const string_piece kLineDirective = "#line "; - assert(directive.starts_with(kLineDirective)); - directive = directive.substr(kLineDirective.size()); - - const int line = std::atoi(directive.data()); - const size_t space_loc = directive.find_first_of(' '); - if (space_loc == string_piece::npos) return std::make_pair(line, ""); - - directive = directive.substr(space_loc); - directive = directive.strip("\" \n"); - return std::make_pair(line, directive); -} - -// Returns the Glslang message rules for the given target environment, -// source language, and whether we want HLSL offset rules. We assume -// only valid combinations are used. -EShMessages GetMessageRules(shaderc_util::Compiler::TargetEnv env, - shaderc_util::Compiler::SourceLanguage lang, - bool hlsl_offsets, bool debug_info) { - using shaderc_util::Compiler; - EShMessages result = EShMsgCascadingErrors; - if (lang == Compiler::SourceLanguage::HLSL) { - result = static_cast(result | EShMsgReadHlsl); - } - switch (env) { - case Compiler::TargetEnv::OpenGLCompat: - // The compiler will have already errored out before now. - // But we need to handle this enum. - break; - case Compiler::TargetEnv::OpenGL: - result = static_cast(result | EShMsgSpvRules); - break; - case Compiler::TargetEnv::Vulkan: - result = - static_cast(result | EShMsgSpvRules | EShMsgVulkanRules); - break; - } - if (hlsl_offsets) { - result = static_cast(result | EShMsgHlslOffsets); - } - if (debug_info) { - result = static_cast(result | EShMsgDebugInfo); - } - return result; -} - -} // anonymous namespace - -namespace shaderc_util { - -unsigned int GlslangInitializer::initialize_count_ = 0; -std::mutex* GlslangInitializer::glslang_mutex_ = nullptr; - -GlslangInitializer::GlslangInitializer() { - static std::mutex first_call_mutex; - - // If this is the first call, glslang_mutex_ needs to be created, but in - // thread safe manner. - { - const std::lock_guard first_call_lock(first_call_mutex); - if (glslang_mutex_ == nullptr) { - glslang_mutex_ = new std::mutex(); - } - } - - const std::lock_guard glslang_lock(*glslang_mutex_); - - if (initialize_count_ == 0) { - glslang::InitializeProcess(); - } - - initialize_count_++; -} - -GlslangInitializer::~GlslangInitializer() { - const std::lock_guard glslang_lock(*glslang_mutex_); - - initialize_count_--; - - if (initialize_count_ == 0) { - glslang::FinalizeProcess(); - // There is no delete for glslang_mutex_ here, because we cannot guarantee - // there isn't a caller waiting for glslang_mutex_ in GlslangInitializer(). - // - // This means that this class does leak one std::mutex worth of memory after - // the final instance is destroyed, but this allows us to defer allocating - // and constructing until we are sure we need to. - } -} - -void Compiler::SetLimit(Compiler::Limit limit, int value) { - switch (limit) { -#define RESOURCE(NAME, FIELD, CNAME) \ - case Limit::NAME: \ - limits_.FIELD = value; \ - break; -#include "libshaderc_util/resources.inc" -#undef RESOURCE - } -} - -int Compiler::GetLimit(Compiler::Limit limit) const { - switch (limit) { -#define RESOURCE(NAME, FIELD, CNAME) \ - case Limit::NAME: \ - return limits_.FIELD; -#include "libshaderc_util/resources.inc" -#undef RESOURCE - } - return 0; // Unreachable -} - -std::tuple, size_t> Compiler::Compile( - const string_piece& input_source_string, EShLanguage forced_shader_stage, - const std::string& error_tag, const char* entry_point_name, - const std::function& - stage_callback, - CountingIncluder& includer, OutputType output_type, - std::ostream* error_stream, size_t* total_warnings, size_t* total_errors) const { - // Compilation results to be returned: - // Initialize the result tuple as a failed compilation. In error cases, we - // should return result_tuple directly without setting its members. - auto result_tuple = - std::make_tuple(false, std::vector(), (size_t)0u); - // Get the reference of the members of the result tuple. We should set their - // values for succeeded compilation before returning the result tuple. - bool& succeeded = std::get<0>(result_tuple); - std::vector& compilation_output_data = std::get<1>(result_tuple); - size_t& compilation_output_data_size_in_bytes = std::get<2>(result_tuple); - - // Check target environment. - const auto target_client_info = GetGlslangClientInfo( - error_tag, target_env_, target_env_version_, - target_spirv_version_, target_spirv_version_is_forced_); - if (!target_client_info.error.empty()) { - *error_stream << target_client_info.error; - *total_warnings = 0; - *total_errors = 1; - return result_tuple; - } - - EShLanguage used_shader_stage = forced_shader_stage; - const std::string macro_definitions = - shaderc_util::format(predefined_macros_, "#define ", " ", "\n"); - const std::string pound_extension = - "#extension GL_GOOGLE_include_directive : enable\n"; - const std::string preamble = macro_definitions + pound_extension; - - std::string preprocessed_shader; - - // If only preprocessing, we definitely need to preprocess. Otherwise, if - // we don't know the stage until now, we need the preprocessed shader to - // deduce the shader stage. - if (output_type == OutputType::PreprocessedText || - used_shader_stage == EShLangCount) { - bool success; - std::string glslang_errors; - std::tie(success, preprocessed_shader, glslang_errors) = - PreprocessShader(error_tag, input_source_string, preamble, includer); - - success &= PrintFilteredErrors(error_tag, error_stream, warnings_as_errors_, - /* suppress_warnings = */ true, - glslang_errors.c_str(), total_warnings, - total_errors); - if (!success) return result_tuple; - // Because of the behavior change of the #line directive, the #line - // directive introducing each file's content must use the syntax for the - // specified version. So we need to probe this shader's version and - // profile. - int version; - EProfile profile; - std::tie(version, profile) = DeduceVersionProfile(preprocessed_shader); - const bool is_for_next_line = LineDirectiveIsForNextLine(version, profile); - - preprocessed_shader = - CleanupPreamble(preprocessed_shader, error_tag, pound_extension, - includer.num_include_directives(), is_for_next_line); - - if (output_type == OutputType::PreprocessedText) { - // Set the values of the result tuple. - succeeded = true; - compilation_output_data = ConvertStringToVector(preprocessed_shader); - compilation_output_data_size_in_bytes = preprocessed_shader.size(); - return result_tuple; - } else if (used_shader_stage == EShLangCount) { - std::string errors; - std::tie(used_shader_stage, errors) = - GetShaderStageFromSourceCode(error_tag, preprocessed_shader); - if (!errors.empty()) { - *error_stream << errors; - return result_tuple; - } - if (used_shader_stage == EShLangCount) { - if ((used_shader_stage = stage_callback(error_stream, error_tag)) == - EShLangCount) { - return result_tuple; - } - } - } - } - - // Parsing requires its own Glslang symbol tables. - glslang::TShader shader(used_shader_stage); - const char* shader_strings = input_source_string.data(); - const int shader_lengths = static_cast(input_source_string.size()); - const char* string_names = error_tag.c_str(); - shader.setStringsWithLengthsAndNames(&shader_strings, &shader_lengths, - &string_names, 1); - shader.setPreamble(preamble.c_str()); - shader.setEntryPoint(entry_point_name); - shader.setAutoMapBindings(auto_bind_uniforms_); - if (auto_combined_image_sampler_) { - shader.setTextureSamplerTransformMode(EShTexSampTransUpgradeTextureRemoveSampler); - } - shader.setAutoMapLocations(auto_map_locations_); - const auto& bases = auto_binding_base_[static_cast(used_shader_stage)]; - shader.setShiftImageBinding(bases[static_cast(UniformKind::Image)]); - shader.setShiftSamplerBinding(bases[static_cast(UniformKind::Sampler)]); - shader.setShiftTextureBinding(bases[static_cast(UniformKind::Texture)]); - shader.setShiftUboBinding(bases[static_cast(UniformKind::Buffer)]); - shader.setShiftSsboBinding( - bases[static_cast(UniformKind::StorageBuffer)]); - shader.setShiftUavBinding( - bases[static_cast(UniformKind::UnorderedAccessView)]); - shader.setHlslIoMapping(hlsl_iomap_); - shader.setResourceSetBinding( - hlsl_explicit_bindings_[static_cast(used_shader_stage)]); - shader.setEnvClient(target_client_info.client, - target_client_info.client_version); - shader.setEnvTarget(target_client_info.target_language, - target_client_info.target_language_version); - if (hlsl_functionality1_enabled_) { - shader.setEnvTargetHlslFunctionality1(); - } - shader.setInvertY(invert_y_enabled_); - shader.setNanMinMaxClamp(nan_clamp_); - - const EShMessages rules = - GetMessageRules(target_env_, source_language_, hlsl_offsets_, - generate_debug_info_); - - bool success = shader.parse(&limits_, default_version_, default_profile_, - force_version_profile_, kNotForwardCompatible, - rules, includer); - - success &= PrintFilteredErrors(error_tag, error_stream, warnings_as_errors_, - suppress_warnings_, shader.getInfoLog(), - total_warnings, total_errors); - if (!success) return result_tuple; - - glslang::TProgram program; - program.addShader(&shader); - success = program.link(EShMsgDefault) && program.mapIO(); - success &= PrintFilteredErrors(error_tag, error_stream, warnings_as_errors_, - suppress_warnings_, program.getInfoLog(), - total_warnings, total_errors); - if (!success) return result_tuple; - - // 'spirv' is an alias for the compilation_output_data. This alias is added - // to serve as an input for the call to DissassemblyBinary. - std::vector& spirv = compilation_output_data; - glslang::SpvOptions options; - options.generateDebugInfo = generate_debug_info_; - options.disableOptimizer = true; - options.optimizeSize = false; - // Note the call to GlslangToSpv also populates compilation_output_data. - glslang::GlslangToSpv(*program.getIntermediate(used_shader_stage), spirv, - &options); - - // Set the tool field (the top 16-bits) in the generator word to - // 'Shaderc over Glslang'. - const uint32_t shaderc_generator_word = 13; // From SPIR-V XML Registry - const uint32_t generator_word_index = 2; // SPIR-V 2.3: Physical layout - assert(spirv.size() > generator_word_index); - spirv[generator_word_index] = - (spirv[generator_word_index] & 0xffff) | (shaderc_generator_word << 16); - - std::vector opt_passes; - - if (hlsl_legalization_enabled_ && source_language_ == SourceLanguage::HLSL) { - // If from HLSL, run this passes to "legalize" the SPIR-V for Vulkan - // eg. forward and remove memory writes of opaque types. - opt_passes.push_back(PassId::kLegalizationPasses); - } - - opt_passes.insert(opt_passes.end(), enabled_opt_passes_.begin(), - enabled_opt_passes_.end()); - - if (!opt_passes.empty()) { - std::string opt_errors; - if (!SpirvToolsOptimize(target_env_, target_env_version_, - opt_passes, &spirv, &opt_errors)) { - *error_stream << "shaderc: internal error: compilation succeeded but " - "failed to optimize: " - << opt_errors << "\n"; - return result_tuple; - } - } - - if (output_type == OutputType::SpirvAssemblyText) { - std::string text_or_error; - if (!SpirvToolsDisassemble(target_env_, target_env_version_, spirv, - &text_or_error)) { - *error_stream << "shaderc: internal error: compilation succeeded but " - "failed to disassemble: " - << text_or_error << "\n"; - return result_tuple; - } - succeeded = true; - compilation_output_data = ConvertStringToVector(text_or_error); - compilation_output_data_size_in_bytes = text_or_error.size(); - return result_tuple; - } else { - succeeded = true; - // Note compilation_output_data is already populated in GlslangToSpv(). - compilation_output_data_size_in_bytes = spirv.size() * sizeof(spirv[0]); - return result_tuple; - } -} - -void Compiler::AddMacroDefinition(const char* macro, size_t macro_length, - const char* definition, - size_t definition_length) { - predefined_macros_[std::string(macro, macro_length)] = - definition ? std::string(definition, definition_length) : ""; -} - -void Compiler::SetTargetEnv(Compiler::TargetEnv env, - Compiler::TargetEnvVersion version) { - target_env_ = env; - target_env_version_ = version; -} - -void Compiler::SetTargetSpirv(Compiler::SpirvVersion version) { - target_spirv_version_ = version; - target_spirv_version_is_forced_ = true; -} - -void Compiler::SetSourceLanguage(Compiler::SourceLanguage lang) { - source_language_ = lang; -} - -void Compiler::SetForcedVersionProfile(int version, EProfile profile) { - default_version_ = version; - default_profile_ = profile; - force_version_profile_ = true; -} - -void Compiler::SetWarningsAsErrors() { warnings_as_errors_ = true; } - -void Compiler::SetGenerateDebugInfo() { - generate_debug_info_ = true; - for (size_t i = 0; i < enabled_opt_passes_.size(); ++i) { - if (enabled_opt_passes_[i] == PassId::kStripDebugInfo) { - enabled_opt_passes_[i] = PassId::kNullPass; - } - } -} - -void Compiler::SetOptimizationLevel(Compiler::OptimizationLevel level) { - // Clear previous settings first. - enabled_opt_passes_.clear(); - - switch (level) { - case OptimizationLevel::Size: - if (!generate_debug_info_) { - enabled_opt_passes_.push_back(PassId::kStripDebugInfo); - } - enabled_opt_passes_.push_back(PassId::kSizePasses); - break; - case OptimizationLevel::Performance: - if (!generate_debug_info_) { - enabled_opt_passes_.push_back(PassId::kStripDebugInfo); - } - enabled_opt_passes_.push_back(PassId::kPerformancePasses); - break; - default: - break; - } -} - -void Compiler::EnableHlslLegalization(bool hlsl_legalization_enabled) { - hlsl_legalization_enabled_ = hlsl_legalization_enabled; -} - -void Compiler::EnableHlslFunctionality1(bool enable) { - hlsl_functionality1_enabled_ = enable; -} - -void Compiler::EnableInvertY(bool enable) { invert_y_enabled_ = enable; } - -void Compiler::SetNanClamp(bool enable) { nan_clamp_ = enable; } - -void Compiler::SetSuppressWarnings() { suppress_warnings_ = true; } - -std::tuple Compiler::PreprocessShader( - const std::string& error_tag, const string_piece& shader_source, - const string_piece& shader_preamble, CountingIncluder& includer) const { - // The stage does not matter for preprocessing. - glslang::TShader shader(EShLangVertex); - const char* shader_strings = shader_source.data(); - const int shader_lengths = static_cast(shader_source.size()); - const char* string_names = error_tag.c_str(); - shader.setStringsWithLengthsAndNames(&shader_strings, &shader_lengths, - &string_names, 1); - shader.setPreamble(shader_preamble.data()); - auto target_client_info = GetGlslangClientInfo( - error_tag, target_env_, target_env_version_, - target_spirv_version_, target_spirv_version_is_forced_); - if (!target_client_info.error.empty()) { - return std::make_tuple(false, "", target_client_info.error); - } - shader.setEnvClient(target_client_info.client, - target_client_info.client_version); - if (hlsl_functionality1_enabled_) { - shader.setEnvTargetHlslFunctionality1(); - } - shader.setInvertY(invert_y_enabled_); - shader.setNanMinMaxClamp(nan_clamp_); - - // The preprocessor might be sensitive to the target environment. - // So combine the existing rules with the just-give-me-preprocessor-output - // flag. - const auto rules = static_cast( - EShMsgOnlyPreprocessor | - GetMessageRules(target_env_, source_language_, hlsl_offsets_, - false)); - - std::string preprocessed_shader; - const bool success = shader.preprocess( - &limits_, default_version_, default_profile_, force_version_profile_, - kNotForwardCompatible, rules, &preprocessed_shader, includer); - - if (success) { - return std::make_tuple(true, preprocessed_shader, shader.getInfoLog()); - } - return std::make_tuple(false, "", shader.getInfoLog()); -} - -std::string Compiler::CleanupPreamble(const string_piece& preprocessed_shader, - const string_piece& error_tag, - const string_piece& pound_extension, - int num_include_directives, - bool is_for_next_line) const { - // Those #define directives in preamble will become empty lines after - // preprocessing. We also injected an #extension directive to turn on #include - // directive support. In the original preprocessing output from glslang, it - // appears before the user source string. We need to do proper adjustment: - // * Remove empty lines generated from #define directives in preamble. - // * If there is no #include directive in the source code, we do not need to - // output the injected #extension directive. Otherwise, - // * If there exists a #version directive in the source code, it should be - // placed at the first line. Its original line will be filled with an empty - // line as placeholder to maintain the code structure. - - const std::vector lines = - preprocessed_shader.get_fields('\n', /* keep_delimiter = */ true); - - std::ostringstream output_stream; - - size_t pound_extension_index = lines.size(); - size_t pound_version_index = lines.size(); - for (size_t i = 0; i < lines.size(); ++i) { - if (lines[i] == pound_extension) { - pound_extension_index = std::min(i, pound_extension_index); - } else if (lines[i].starts_with("#version")) { - // In a preprocessed shader, directives are in a canonical format, so we - // can confidently compare to '#version' verbatim, without worrying about - // whitespace. - pound_version_index = i; - if (num_include_directives > 0) output_stream << lines[i]; - break; - } - } - // We know that #extension directive exists and appears before #version - // directive (if any). - assert(pound_extension_index < lines.size()); - - for (size_t i = 0; i < pound_extension_index; ++i) { - // All empty lines before the #line directive we injected are generated by - // preprocessing preamble. Do not output them. - if (lines[i].strip_whitespace().empty()) continue; - output_stream << lines[i]; - } - - if (num_include_directives > 0) { - output_stream << pound_extension; - // Also output a #line directive for the main file. - output_stream << GetLineDirective(is_for_next_line, error_tag); - } - - for (size_t i = pound_extension_index + 1; i < lines.size(); ++i) { - if (i == pound_version_index) { - if (num_include_directives > 0) { - output_stream << "\n"; - } else { - output_stream << lines[i]; - } - } else { - output_stream << lines[i]; - } - } - - return output_stream.str(); -} - -std::pair Compiler::GetShaderStageFromSourceCode( - string_piece filename, const std::string& preprocessed_shader) const { - const string_piece kPragmaShaderStageDirective = "#pragma shader_stage"; - const string_piece kLineDirective = "#line"; - - int version; - EProfile profile; - std::tie(version, profile) = DeduceVersionProfile(preprocessed_shader); - const bool is_for_next_line = LineDirectiveIsForNextLine(version, profile); - - std::vector lines = - string_piece(preprocessed_shader).get_fields('\n'); - // The filename, logical line number (which starts from 1 and is sensitive to - // #line directives), and stage value for #pragma shader_stage() directives. - std::vector> stages; - // The physical line numbers of the first #pragma shader_stage() line and - // first non-preprocessing line in the preprocessed shader text. - size_t first_pragma_physical_line = lines.size() + 1; - size_t first_non_pp_line = lines.size() + 1; - - for (size_t i = 0, logical_line_no = 1; i < lines.size(); ++i) { - const string_piece current_line = lines[i].strip_whitespace(); - if (current_line.starts_with(kPragmaShaderStageDirective)) { - const string_piece stage_value = - current_line.substr(kPragmaShaderStageDirective.size()).strip("()"); - stages.emplace_back(filename, logical_line_no, stage_value); - first_pragma_physical_line = std::min(first_pragma_physical_line, i + 1); - } else if (!current_line.empty() && !current_line.starts_with("#")) { - first_non_pp_line = std::min(first_non_pp_line, i + 1); - } - - // Update logical line number for the next line. - if (current_line.starts_with(kLineDirective)) { - string_piece name; - std::tie(logical_line_no, name) = DecodeLineDirective(current_line); - if (!name.empty()) filename = name; - // Note that for core profile, the meaning of #line changed since version - // 330. The line number given by #line used to mean the logical line - // number of the #line line. Now it means the logical line number of the - // next line after the #line line. - if (!is_for_next_line) ++logical_line_no; - } else { - ++logical_line_no; - } - } - if (stages.empty()) return std::make_pair(EShLangCount, ""); - - std::string error_message; - - const string_piece& first_pragma_filename = std::get<0>(stages[0]); - const std::string first_pragma_line = std::to_string(std::get<1>(stages[0])); - const string_piece& first_pragma_stage = std::get<2>(stages[0]); - - if (first_pragma_physical_line > first_non_pp_line) { - error_message += first_pragma_filename.str() + ":" + first_pragma_line + - ": error: '#pragma': the first 'shader_stage' #pragma " - "must appear before any non-preprocessing code\n"; - } - - EShLanguage stage = MapStageNameToLanguage(first_pragma_stage); - if (stage == EShLangCount) { - error_message += - first_pragma_filename.str() + ":" + first_pragma_line + - ": error: '#pragma': invalid stage for 'shader_stage' #pragma: '" + - first_pragma_stage.str() + "'\n"; - } - - for (size_t i = 1; i < stages.size(); ++i) { - const string_piece& current_stage = std::get<2>(stages[i]); - if (current_stage != first_pragma_stage) { - const string_piece& current_filename = std::get<0>(stages[i]); - const std::string current_line = std::to_string(std::get<1>(stages[i])); - error_message += current_filename.str() + ":" + current_line + - ": error: '#pragma': conflicting stages for " - "'shader_stage' #pragma: '" + - current_stage.str() + "' (was '" + - first_pragma_stage.str() + "' at " + - first_pragma_filename.str() + ":" + first_pragma_line + - ")\n"; - } - } - - return std::make_pair(error_message.empty() ? stage : EShLangCount, - error_message); -} - -std::pair Compiler::DeduceVersionProfile( - const std::string& preprocessed_shader) const { - int version = default_version_; - EProfile profile = default_profile_; - if (!force_version_profile_) { - std::tie(version, profile) = - GetVersionProfileFromSourceCode(preprocessed_shader); - if (version == 0 && profile == ENoProfile) { - version = default_version_; - profile = default_profile_; - } - } - return std::make_pair(version, profile); -} - -std::pair Compiler::GetVersionProfileFromSourceCode( - const std::string& preprocessed_shader) const { - string_piece pound_version = preprocessed_shader; - const size_t pound_version_loc = pound_version.find("#version"); - if (pound_version_loc == string_piece::npos) { - return std::make_pair(0, ENoProfile); - } - pound_version = - pound_version.substr(pound_version_loc + std::strlen("#version")); - pound_version = pound_version.substr(0, pound_version.find_first_of("\n")); - - std::string version_profile; - for (const auto character : pound_version) { - if (character != ' ') version_profile += character; - } - - int version; - EProfile profile; - if (!ParseVersionProfile(version_profile, &version, &profile)) { - return std::make_pair(0, ENoProfile); - } - return std::make_pair(version, profile); -} - -// Converts a string to a vector of uint32_t by copying the content of a given -// string to a vector and returns it. Appends '\0' at the end if extra -// bytes are required to complete the last element. -std::vector ConvertStringToVector(const std::string& str) { - size_t num_bytes_str = str.size() + 1u; - size_t vector_length = - (num_bytes_str + sizeof(uint32_t) - 1) / sizeof(uint32_t); - std::vector result_vec(vector_length, 0); - std::strncpy(reinterpret_cast(result_vec.data()), str.c_str(), - str.size()); - return result_vec; -} - -GlslangClientInfo GetGlslangClientInfo( - const std::string& error_tag, shaderc_util::Compiler::TargetEnv env, - shaderc_util::Compiler::TargetEnvVersion env_version, - shaderc_util::Compiler::SpirvVersion spv_version, - bool spv_version_is_forced) { - GlslangClientInfo result; - std::ostringstream errs; - - using shaderc_util::Compiler; - switch (env) { - case Compiler::TargetEnv::Vulkan: - result.client = glslang::EShClientVulkan; - if (env_version == Compiler::TargetEnvVersion::Default || - env_version == Compiler::TargetEnvVersion::Vulkan_1_0) { - result.client_version = glslang::EShTargetVulkan_1_0; - } else if (env_version == Compiler::TargetEnvVersion::Vulkan_1_1) { - result.client_version = glslang::EShTargetVulkan_1_1; - result.target_language_version = glslang::EShTargetSpv_1_3; - } else if (env_version == Compiler::TargetEnvVersion::Vulkan_1_2) { - result.client_version = glslang::EShTargetVulkan_1_2; - result.target_language_version = glslang::EShTargetSpv_1_5; - } else if (env_version == Compiler::TargetEnvVersion::Vulkan_1_3) { - result.client_version = glslang::EShTargetVulkan_1_3; - result.target_language_version = glslang::EShTargetSpv_1_6; - } else { - errs << "error:" << error_tag << ": Invalid target client version " - << static_cast(env_version) << " for Vulkan environment " - << int(env); - } - break; - case Compiler::TargetEnv::OpenGLCompat: - errs << "error: OpenGL compatibility profile is not supported"; - break; - case Compiler::TargetEnv::OpenGL: - result.client = glslang::EShClientOpenGL; - if (env_version == Compiler::TargetEnvVersion::Default || - env_version == Compiler::TargetEnvVersion::OpenGL_4_5) { - result.client_version = glslang::EShTargetOpenGL_450; - } else { - errs << "error:" << error_tag << ": Invalid target client version " - << static_cast(env_version) << " for OpenGL environment " - << int(env); - } - break; - default: - errs << "error:" << error_tag << ": Invalid target client environment " - << int(env); - break; - } - - if (spv_version_is_forced && errs.str().empty()) { - switch (spv_version) { - case Compiler::SpirvVersion::v1_0: - result.target_language_version = glslang::EShTargetSpv_1_0; - break; - case Compiler::SpirvVersion::v1_1: - result.target_language_version = glslang::EShTargetSpv_1_1; - break; - case Compiler::SpirvVersion::v1_2: - result.target_language_version = glslang::EShTargetSpv_1_2; - break; - case Compiler::SpirvVersion::v1_3: - result.target_language_version = glslang::EShTargetSpv_1_3; - break; - case Compiler::SpirvVersion::v1_4: - result.target_language_version = glslang::EShTargetSpv_1_4; - break; - case Compiler::SpirvVersion::v1_5: - result.target_language_version = glslang::EShTargetSpv_1_5; - break; - case Compiler::SpirvVersion::v1_6: - result.target_language_version = glslang::EShTargetSpv_1_6; - break; - default: - errs << "error:" << error_tag << ": Unknown SPIR-V version " << std::hex - << uint32_t(spv_version); - break; - } - } - result.error = errs.str(); - return result; -} - -} // namespace shaderc_util diff --git a/lib/shaderc/libshaderc_util/src/compiler_test.cc b/lib/shaderc/libshaderc_util/src/compiler_test.cc deleted file mode 100644 index a0a964d3f..000000000 --- a/lib/shaderc/libshaderc_util/src/compiler_test.cc +++ /dev/null @@ -1,950 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/compiler.h" - -#include - -#include - -#include "death_test.h" -#include "libshaderc_util/counting_includer.h" -#include "libshaderc_util/spirv_tools_wrapper.h" - -namespace { - -using shaderc_util::Compiler; -using shaderc_util::GlslangClientInfo; -using ::testing::Eq; -using ::testing::HasSubstr; -using ::testing::Not; - -// A trivial vertex shader -const char kVertexShader[] = - "#version 140\n" - "void main() {}"; - -// A shader that parses under OpenGL compatibility profile rules. -// It does not compile because Glslang does not support SPIR-V -// code generation for OpenGL compatibility profile. -const char kOpenGLCompatibilityFragShader[] = - R"(#version 140 - uniform highp sampler2D tex; - void main() { - gl_FragColor = texture2D(tex, vec2(0.0,0.0)); - })"; - -// A shader that compiles under OpenGL core profile rules. -const char kOpenGLVertexShader[] = - R"(#version 330 - void main() { int t = gl_VertexID; })"; - -// A shader that compiles under OpenGL core profile rules, even when -// deducing the stage. -const char kOpenGLVertexShaderDeducibleStage[] = - R"(#version 330 - #pragma shader_stage(vertex) - void main() { int t = gl_VertexID; })"; - -// A shader that compiles under Vulkan rules. -// See the GL_KHR_vuklan_glsl extension to GLSL. -const char kVulkanVertexShader[] = - R"(#version 310 es - void main() { int t = gl_VertexIndex; })"; - -// A shader that needs valueless macro predefinition E, to be compiled -// successfully. -const std::string kValuelessPredefinitionShader = - "#version 140\n" - "#ifdef E\n" - "void main(){}\n" - "#else\n" - "#error\n" - "#endif"; - -// An HLSL vertex shader. -const char kHlslVertexShader[] = - R"(float4 EntryPoint(uint index : SV_VERTEXID) : SV_POSITION - { return float4(1.0, 2.0, 3.0, 4.0); })"; - -// A GLSL fragment shader without bindings for its uniforms. -// This also can be compiled as a vertex or compute shader. -const char kGlslFragShaderNoExplicitBinding[] = - R"(#version 450 - #extension GL_ARB_sparse_texture2: enable - uniform texture2D my_tex; - uniform sampler my_sam; - layout(rgba32f) uniform image2D my_img; - layout(rgba32f) uniform imageBuffer my_imbuf; - uniform block { float x; float y; } my_ubo; - void main() { - texture(sampler2D(my_tex,my_sam),vec2(1.0)); - vec4 t = vec4(1.0); - sparseImageLoadARB(my_img,ivec2(0),t); - imageLoad(my_imbuf,2); - float x = my_ubo.x; - })"; - -// A GLSL vertex shader with the location defined for its non-opaque uniform -// variable. -const char kGlslVertShaderExplicitLocation[] = - R"(#version 450 - layout(location = 10) uniform mat4 my_mat; - layout(location = 0) in vec4 my_vec; - void main(void) { - gl_Position = my_mat * my_vec; - })"; - -// A GLSL vertex shader without the location defined for its non-opaque uniform -// variable. -const char kGlslVertShaderNoExplicitLocation[] = - R"(#version 450 - uniform mat4 my_mat; - layout(location = 0) in vec4 my_vec; - void main(void) { - gl_Position = my_mat * my_vec; - })"; - -// A GLSL vertex shader with a weirdly packed block. -const char kGlslShaderWeirdPacking[] = - R"(#version 450 - layout(set = 0, binding = 0) - buffer B { float x; vec3 foo; } my_ssbo; - void main() { my_ssbo.x = 1.0; })"; - -const char kHlslShaderForLegalizationTest[] = R"( -struct CombinedTextureSampler { - Texture2D tex; - SamplerState sampl; -}; - -float4 sampleTexture(CombinedTextureSampler c, float2 loc) { - return c.tex.Sample(c.sampl, loc); -}; - -[[vk::binding(0,0)]] -Texture2D gTex; -[[vk::binding(0,1)]] -SamplerState gSampler; - -float4 main(float2 loc: A) : SV_Target { - CombinedTextureSampler cts; - cts.tex = gTex; - cts.sampl = gSampler; - - return sampleTexture(cts, loc); -})"; - -const char kHlslShaderWithCounterBuffer[] = R"( -[[vk::binding(0,0)]] -RWStructuredBuffer Ainc; -float4 main() : SV_Target0 { - return float4(Ainc.IncrementCounter(), 0, 0, 0); -} -)"; - -const char kGlslShaderWithClamp[] = R"(#version 450 -layout(location=0) in vec4 i; -layout(location=0) out vec4 o; -void main() { o = clamp(i, vec4(0.5), vec4(1.0)); } -)"; - -// Returns the disassembly of the given SPIR-V binary, as a string. -// Assumes the disassembly will be successful when targeting Vulkan. -std::string Disassemble(const std::vector binary) { - std::string result; - shaderc_util::SpirvToolsDisassemble(Compiler::TargetEnv::Vulkan, - Compiler::TargetEnvVersion::Vulkan_1_3, - binary, &result); - return result; -} - -// A CountingIncluder that never returns valid content for a requested -// file inclusion. -class DummyCountingIncluder : public shaderc_util::CountingIncluder { - private: - // Returns a pair of empty strings. - virtual glslang::TShader::Includer::IncludeResult* include_delegate( - const char*, const char*, IncludeType, size_t) override { - return nullptr; - } - virtual void release_delegate( - glslang::TShader::Includer::IncludeResult*) override {} -}; - -// A test fixture for compiling GLSL shaders. -class CompilerTest : public testing::Test { - public: - // Returns true if the given compiler successfully compiles the given shader - // source for the given shader stage to the specified output type. No - // includes are permitted, and shader stage deduction falls back to an invalid - // shader stage. - bool SimpleCompilationSucceedsForOutputType( - std::string source, EShLanguage stage, Compiler::OutputType output_type) { - shaderc_util::GlslangInitializer initializer; - std::stringstream errors; - size_t total_warnings = 0; - size_t total_errors = 0; - bool result = false; - DummyCountingIncluder dummy_includer; - std::tie(result, std::ignore, std::ignore) = compiler_.Compile( - source, stage, "shader", "main", dummy_stage_callback_, dummy_includer, - Compiler::OutputType::SpirvBinary, &errors, &total_warnings, - &total_errors); - errors_ = errors.str(); - return result; - } - - // Returns the result of SimpleCompilationSucceedsForOutputType, where - // the output type is a SPIR-V binary module. - bool SimpleCompilationSucceeds(std::string source, EShLanguage stage) { - return SimpleCompilationSucceedsForOutputType( - source, stage, Compiler::OutputType::SpirvBinary); - } - - // Returns the SPIR-V binary for a successful compilation of a shader. - std::vector SimpleCompilationBinary(std::string source, - EShLanguage stage) { - shaderc_util::GlslangInitializer initializer; - std::stringstream errors; - size_t total_warnings = 0; - size_t total_errors = 0; - bool result = false; - DummyCountingIncluder dummy_includer; - std::vector words; - std::tie(result, words, std::ignore) = compiler_.Compile( - source, stage, "shader", "main", dummy_stage_callback_, dummy_includer, - Compiler::OutputType::SpirvBinary, &errors, &total_warnings, - &total_errors); - errors_ = errors.str(); - EXPECT_TRUE(result) << errors_; - return words; - } - - protected: - Compiler compiler_; - // The error string from the most recent compilation. - std::string errors_; - std::function - dummy_stage_callback_ = - [](std::ostream*, const shaderc_util::string_piece&) { - return EShLangCount; - }; -}; - -TEST_F(CompilerTest, SimpleVertexShaderCompilesSuccessfullyToBinary) { - EXPECT_TRUE(SimpleCompilationSucceeds(kVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, SimpleVertexShaderCompilesSuccessfullyToAssembly) { - EXPECT_TRUE(SimpleCompilationSucceedsForOutputType( - kVertexShader, EShLangVertex, Compiler::OutputType::SpirvAssemblyText)); -} - -TEST_F(CompilerTest, SimpleVertexShaderPreprocessesSuccessfully) { - EXPECT_TRUE(SimpleCompilationSucceedsForOutputType( - kVertexShader, EShLangVertex, Compiler::OutputType::PreprocessedText)); -} - -TEST_F(CompilerTest, BadVertexShaderFailsCompilation) { - EXPECT_FALSE(SimpleCompilationSucceeds(" bogus ", EShLangVertex)); -} - -TEST_F(CompilerTest, SimpleVulkanShaderCompilesWithDefaultCompilerSettings) { - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, OpenGLCompatibilityProfileNotSupported) { - const EShLanguage stage = EShLangVertex; - - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGLCompat); - EXPECT_FALSE(SimpleCompilationSucceeds(kOpenGLVertexShader, stage)); - EXPECT_EQ(errors_, "error: OpenGL compatibility profile is not supported"); -} - -TEST_F(CompilerTest, RespectTargetEnvOnOpenGLShaderForOpenGLShader) { - const EShLanguage stage = EShLangVertex; - - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL); - EXPECT_TRUE(SimpleCompilationSucceeds(kOpenGLVertexShader, stage)); -} - -TEST_F(CompilerTest, RespectTargetEnvOnOpenGLShaderWhenDeducingStage) { - const EShLanguage stage = EShLangVertex; - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL); - EXPECT_TRUE( - SimpleCompilationSucceeds(kOpenGLVertexShaderDeducibleStage, stage)); -} - -TEST_F(CompilerTest, RespectTargetEnvOnVulkanShader) { - compiler_.SetTargetEnv(Compiler::TargetEnv::Vulkan); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, VulkanSpecificShaderFailsUnderOpenGLCompatibilityRules) { - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGLCompat); - EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, VulkanSpecificShaderFailsUnderOpenGLRules) { - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL); - EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, OpenGLSpecificShaderFailsUnderDefaultRules) { - EXPECT_FALSE(SimpleCompilationSucceeds(kOpenGLVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, - OpenGLCompatibilitySpecificShaderFailsUnderOpenGLCompatibilityRules) { - // OpenGLCompat mode now errors out. It's been deprecated for a long time. - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGLCompat); - EXPECT_FALSE(SimpleCompilationSucceeds(kOpenGLCompatibilityFragShader, - EShLangFragment)); -} - -TEST_F(CompilerTest, OpenGLCompatibilitySpecificShaderFailsUnderOpenGLRules) { - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL); - EXPECT_FALSE(SimpleCompilationSucceeds(kOpenGLCompatibilityFragShader, - EShLangFragment)); -} - -TEST_F(CompilerTest, OpenGLCompatibilitySpecificShaderFailsUnderVulkanRules) { - compiler_.SetTargetEnv(Compiler::TargetEnv::Vulkan); - EXPECT_FALSE(SimpleCompilationSucceeds(kOpenGLCompatibilityFragShader, - EShLangFragment)); -} - -TEST_F(CompilerTest, OpenGLSpecificShaderFailsUnderVulkanRules) { - compiler_.SetTargetEnv(Compiler::TargetEnv::Vulkan); - EXPECT_FALSE(SimpleCompilationSucceeds(kOpenGLVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, BadTargetEnvFails) { - compiler_.SetTargetEnv(static_cast(32767)); - EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, HasSubstr("Invalid target client environment 32767")); -} - -TEST_F(CompilerTest, BadTargetEnvVulkanVersionFails) { - compiler_.SetTargetEnv(Compiler::TargetEnv::Vulkan, - static_cast(123)); - EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, - HasSubstr("Invalid target client version 123 for Vulkan environment 0")); -} - -TEST_F(CompilerTest, BadTargetEnvOpenGLVersionFails) { - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL, - static_cast(123)); - EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, - HasSubstr("Invalid target client version 123 for OpenGL environment 1")); -} - -TEST_F(CompilerTest, SpirvTargetVersion1_0Succeeds) { - compiler_.SetTargetSpirv(Compiler::SpirvVersion::v1_0); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, Eq("")); -} - -TEST_F(CompilerTest, SpirvTargetVersion1_1Succeeds) { - compiler_.SetTargetSpirv(Compiler::SpirvVersion::v1_1); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, Eq("")); -} - -TEST_F(CompilerTest, SpirvTargetVersion1_2Succeeds) { - compiler_.SetTargetSpirv(Compiler::SpirvVersion::v1_2); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, Eq("")); -} - -TEST_F(CompilerTest, SpirvTargetVersion1_3Succeeds) { - compiler_.SetTargetSpirv(Compiler::SpirvVersion::v1_3); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, Eq("")); -} - -TEST_F(CompilerTest, SpirvTargetVersion1_4Succeeds) { - compiler_.SetTargetSpirv(Compiler::SpirvVersion::v1_4); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, Eq("")); -} - -TEST_F(CompilerTest, SpirvTargetVersion1_5Succeeds) { - compiler_.SetTargetSpirv(Compiler::SpirvVersion::v1_5); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, Eq("")); -} - -TEST_F(CompilerTest, SpirvTargetVersion1_6Succeeds) { - compiler_.SetTargetSpirv(Compiler::SpirvVersion::v1_6); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, Eq("")); -} - -TEST_F(CompilerTest, SpirvTargetBadVersionFails) { - compiler_.SetTargetSpirv(static_cast(0x090900)); - EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, HasSubstr(": Unknown SPIR-V version 90900")); -} - -TEST_F(CompilerTest, AddMacroDefinition) { - const std::string kMinimalExpandedShader = "#version 140\nvoid E(){}"; - compiler_.AddMacroDefinition("E", 1u, "main", 4u); - EXPECT_TRUE(SimpleCompilationSucceeds(kMinimalExpandedShader, EShLangVertex)); -} - -TEST_F(CompilerTest, AddValuelessMacroDefinitionNullPointer) { - compiler_.AddMacroDefinition("E", 1u, nullptr, 100u); - EXPECT_TRUE( - SimpleCompilationSucceeds(kValuelessPredefinitionShader, EShLangVertex)); -} - -TEST_F(CompilerTest, AddValuelessMacroDefinitionZeroLength) { - compiler_.AddMacroDefinition("E", 1u, "something", 0u); - EXPECT_TRUE( - SimpleCompilationSucceeds(kValuelessPredefinitionShader, EShLangVertex)); -} - -TEST_F(CompilerTest, AddMacroDefinitionNotNullTerminated) { - const std::string kMinimalExpandedShader = "#version 140\nvoid E(){}"; - compiler_.AddMacroDefinition("EFGH", 1u, "mainnnnnn", 4u); - EXPECT_TRUE(SimpleCompilationSucceeds(kMinimalExpandedShader, EShLangVertex)); -} - -// A convert-string-to-vector test case consists of 1) an input string; 2) an -// expected vector after the conversion. -struct ConvertStringToVectorTestCase { - std::string input_str; - std::vector expected_output_vec; -}; - -// Test the shaderc_util::ConvertStringToVector() function. The content of the -// input string, including the null terminator, should be packed into uint32_t -// cells and stored in the returned vector of uint32_t. In case extra bytes are -// required to complete the ending uint32_t element, bytes with value 0x00 -// should be used to fill the space. -using ConvertStringToVectorTestFixture = - testing::TestWithParam; - -TEST_P(ConvertStringToVectorTestFixture, VariousStringSize) { - const ConvertStringToVectorTestCase& test_case = GetParam(); - EXPECT_EQ(test_case.expected_output_vec, - shaderc_util::ConvertStringToVector(test_case.input_str)) - << "test_case.input_str: " << test_case.input_str << std::endl; -} - -INSTANTIATE_TEST_SUITE_P( - ConvertStringToVectorTest, ConvertStringToVectorTestFixture, - testing::ValuesIn(std::vector{ - {"", {0x00000000}}, - {"1", {0x00000031}}, - {"12", {0x00003231}}, - {"123", {0x00333231}}, - {"1234", {0x34333231, 0x00000000}}, - {"12345", {0x34333231, 0x00000035}}, - {"123456", {0x34333231, 0x00003635}}, - {"1234567", {0x34333231, 0x00373635}}, - {"12345678", {0x34333231, 0x38373635, 0x00000000}}, - {"123456789", {0x34333231, 0x38373635, 0x00000039}}, - })); - -TEST_F(CompilerTest, SetSourceLanguageToGLSLSucceeds) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::GLSL); - EXPECT_TRUE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, SetSourceLanguageToGLSLFailsOnHLSL) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::GLSL); - EXPECT_FALSE(SimpleCompilationSucceeds(kHlslVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, SetSourceLanguageToHLSLSucceeds) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::HLSL); - EXPECT_TRUE(SimpleCompilationSucceeds(kHlslVertexShader, EShLangVertex)) - << errors_; -} - -TEST_F(CompilerTest, SetSourceLanguageToHLSLFailsOnGLSL) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::HLSL); - EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); -} - -TEST_F(CompilerTest, EntryPointParameterTakesEffectForHLSL) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::HLSL); - std::stringstream errors; - size_t total_warnings = 0; - size_t total_errors = 0; - shaderc_util::GlslangInitializer initializer; - bool result = false; - DummyCountingIncluder dummy_includer; - std::vector words; - std::tie(result, words, std::ignore) = - compiler_.Compile(kHlslVertexShader, EShLangVertex, "shader", - "EntryPoint", dummy_stage_callback_, dummy_includer, - Compiler::OutputType::SpirvAssemblyText, &errors, - &total_warnings, &total_errors); - EXPECT_TRUE(result); - std::string assembly(reinterpret_cast(words.data())); - EXPECT_THAT(assembly, - HasSubstr("OpEntryPoint Vertex %EntryPoint \"EntryPoint\"")) - << assembly; -} - -// A test case for setting resource limits. -struct SetLimitCase { - Compiler::Limit limit; - int default_value; - int value; -}; - -using LimitTest = testing::TestWithParam; - -TEST_P(LimitTest, Sample) { - Compiler compiler; - EXPECT_THAT(compiler.GetLimit(GetParam().limit), - Eq(GetParam().default_value)); - compiler.SetLimit(GetParam().limit, GetParam().value); - EXPECT_THAT(compiler.GetLimit(GetParam().limit), Eq(GetParam().value)); -} - -#define CASE(LIMIT, DEFAULT, NEW) \ - { Compiler::Limit::LIMIT, DEFAULT, NEW } -INSTANTIATE_TEST_SUITE_P( - CompilerTest, LimitTest, - // See resources.cc for the defaults. - testing::ValuesIn(std::vector{ - // clang-format off - // This is just a sampling of the possible values. - CASE(MaxLights, 8, 99), - CASE(MaxClipPlanes, 6, 10929), - CASE(MaxTessControlAtomicCounters, 0, 72), - CASE(MaxSamples, 4, 8), - // clang-format on - })); -#undef CASE - -// Returns a fragment shader accessing a texture with the given -// offset. -std::string ShaderWithTexOffset(int offset) { - std::ostringstream oss; - oss << "#version 450\n" - "layout (binding=0) uniform sampler1D tex;\n" - "void main() { vec4 x = textureOffset(tex, 1.0, " - << offset << "); }\n"; - return oss.str(); -} - -// Ensure compilation is sensitive to limit setting. Sample just -// two particular limits. The default minimum texel offset is -8, -// and the default maximum texel offset is 7. -TEST_F(CompilerTest, TexelOffsetDefaults) { - const EShLanguage stage = EShLangFragment; - EXPECT_FALSE(SimpleCompilationSucceeds(ShaderWithTexOffset(-9), stage)); - EXPECT_TRUE(SimpleCompilationSucceeds(ShaderWithTexOffset(-8), stage)); - EXPECT_TRUE(SimpleCompilationSucceeds(ShaderWithTexOffset(7), stage)); - EXPECT_FALSE(SimpleCompilationSucceeds(ShaderWithTexOffset(8), stage)); -} - -TEST_F(CompilerTest, TexelOffsetLowerTheMinimum) { - const EShLanguage stage = EShLangFragment; - compiler_.SetLimit(Compiler::Limit::MinProgramTexelOffset, -99); - EXPECT_FALSE(SimpleCompilationSucceeds(ShaderWithTexOffset(-100), stage)); - EXPECT_TRUE(SimpleCompilationSucceeds(ShaderWithTexOffset(-99), stage)); -} - -TEST_F(CompilerTest, TexelOffsetRaiseTheMaximum) { - const EShLanguage stage = EShLangFragment; - compiler_.SetLimit(Compiler::Limit::MaxProgramTexelOffset, 100); - EXPECT_TRUE(SimpleCompilationSucceeds(ShaderWithTexOffset(100), stage)); - EXPECT_FALSE(SimpleCompilationSucceeds(ShaderWithTexOffset(101), stage)); -} - -TEST_F(CompilerTest, GeneratorWordIsShadercOverGlslang) { - const auto words = SimpleCompilationBinary(kVertexShader, EShLangVertex); - const uint32_t shaderc_over_glslang = 13; // From SPIR-V XML Registry - const uint32_t generator_word_index = 2; // From SPIR-V binary layout - EXPECT_EQ(shaderc_over_glslang, words[generator_word_index] >> 16u); -} - -TEST_F(CompilerTest, NoBindingsAndNoAutoMapBindingsFailsCompile) { - compiler_.SetAutoBindUniforms(false); - EXPECT_FALSE(SimpleCompilationSucceeds(kGlslFragShaderNoExplicitBinding, - EShLangFragment)); - EXPECT_THAT(errors_, - HasSubstr("sampler/texture/image requires layout(binding=X)")); -} - -TEST_F(CompilerTest, AutoMapBindingsSetsBindings) { - compiler_.SetAutoBindUniforms(true); - const auto words = SimpleCompilationBinary(kGlslFragShaderNoExplicitBinding, - EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_tex Binding 0")) - << disassembly; - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_ubo Binding 4")); -} - -TEST_F(CompilerTest, SetBindingBaseForTextureAdjustsTextureBindingsOnly) { - compiler_.SetAutoBindUniforms(true); - compiler_.SetAutoBindingBase(Compiler::UniformKind::Texture, 42); - const auto words = SimpleCompilationBinary(kGlslFragShaderNoExplicitBinding, - EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_tex Binding 42")) - << disassembly; - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_sam Binding 0")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_img Binding 1")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_imbuf Binding 2")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_ubo Binding 3")); -} - -TEST_F(CompilerTest, SetBindingBaseForSamplersAdjustsSamplerBindingsOnly) { - compiler_.SetAutoBindUniforms(true); - compiler_.SetAutoBindingBase(Compiler::UniformKind::Sampler, 42); - const auto words = SimpleCompilationBinary(kGlslFragShaderNoExplicitBinding, - EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_tex Binding 0")) - << disassembly; - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_sam Binding 42")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_img Binding 1")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_imbuf Binding 2")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_ubo Binding 3")); -} - -TEST_F(CompilerTest, SetBindingBaseForImagesAdjustsImageBindingsOnly) { - compiler_.SetAutoBindUniforms(true); - compiler_.SetAutoBindingBase(Compiler::UniformKind::Image, 42); - const auto words = SimpleCompilationBinary(kGlslFragShaderNoExplicitBinding, - EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_tex Binding 0")) - << disassembly; - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_img Binding 42")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_imbuf Binding 43")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_ubo Binding 2")); -} - -TEST_F(CompilerTest, SetBindingBaseForBufferAdjustsBufferBindingsOnly) { - compiler_.SetAutoBindUniforms(true); - compiler_.SetAutoBindingBase(Compiler::UniformKind::Buffer, 42); - const auto words = SimpleCompilationBinary(kGlslFragShaderNoExplicitBinding, - EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_tex Binding 0")) - << disassembly; - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_ubo Binding 42")); -} - -TEST_F(CompilerTest, - AutoMapBindingsSetsBindingsSetFragTextureBindingBaseCompiledAsFrag) { - compiler_.SetAutoBindUniforms(true); - compiler_.SetAutoBindingBaseForStage(Compiler::Stage::Fragment, - Compiler::UniformKind::Texture, 100); - const auto words = SimpleCompilationBinary(kGlslFragShaderNoExplicitBinding, - EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_tex Binding 100")) - << disassembly; - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_sam Binding 0")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_img Binding 1")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_imbuf Binding 2")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_ubo Binding 3")); -} - -TEST_F(CompilerTest, - AutoMapBindingsSetsBindingsSetFragImageBindingBaseCompiledAsVert) { - compiler_.SetAutoBindUniforms(true); - // This is ignored because we're compiling the shader as a vertex shader, not - // as a fragment shader. - compiler_.SetAutoBindingBaseForStage(Compiler::Stage::Fragment, - Compiler::UniformKind::Image, 100); - const auto words = - SimpleCompilationBinary(kGlslFragShaderNoExplicitBinding, EShLangVertex); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_tex Binding 0")) - << disassembly; - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_sam Binding 1")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_img Binding 2")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_imbuf Binding 3")); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_ubo Binding 4")); -} - -TEST_F(CompilerTest, NoAutoMapLocationsFailsCompilationOnOpenGLShader) { - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL); - compiler_.SetAutoMapLocations(false); - - const auto words = - SimpleCompilationBinary(kGlslVertShaderExplicitLocation, EShLangVertex); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpDecorate %my_mat Location 10")) - << disassembly; - - EXPECT_FALSE(SimpleCompilationSucceeds(kGlslVertShaderNoExplicitLocation, - EShLangVertex)); -} - -TEST_F(CompilerTest, AutoMapLocationsSetsLocationsOnOpenGLShader) { - compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL); - compiler_.SetAutoMapLocations(true); - - const auto words_no_auto = - SimpleCompilationBinary(kGlslVertShaderExplicitLocation, EShLangVertex); - const auto disassembly_no_auto = Disassemble(words_no_auto); - EXPECT_THAT(disassembly_no_auto, HasSubstr("OpDecorate %my_mat Location 10")) - << disassembly_no_auto; - - const auto words_auto = - SimpleCompilationBinary(kGlslVertShaderNoExplicitLocation, EShLangVertex); - const auto disassembly_auto = Disassemble(words_auto); - EXPECT_THAT(disassembly_auto, HasSubstr("OpDecorate %my_mat Location 0")) - << disassembly_auto; -} - -TEST_F(CompilerTest, EmitMessageTextOnlyOnce) { - // Emit a warning by compiling a shader without a default entry point name. - // The warning should only be emitted once even though we do parsing, linking, - // and IO mapping. - Compiler c; - std::stringstream errors; - size_t total_warnings = 0; - size_t total_errors = 0; - shaderc_util::GlslangInitializer initializer; - bool result = false; - DummyCountingIncluder dummy_includer; - std::tie(result, std::ignore, std::ignore) = c.Compile( - "#version 150\nvoid MyEntryPoint(){}", EShLangVertex, "shader", "", - dummy_stage_callback_, dummy_includer, Compiler::OutputType::SpirvBinary, - &errors, &total_warnings, &total_errors); - const std::string errs = errors.str(); - EXPECT_THAT(errs, Eq("shader: error: Linking vertex stage: Missing entry " - "point: Each stage requires one entry point\n")) - << errs; -} - -TEST_F(CompilerTest, GlslDefaultPackingUsed) { - const auto words = - SimpleCompilationBinary(kGlslShaderWeirdPacking, EShLangVertex); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpMemberDecorate %B 1 Offset 16")) - << disassembly; -} - -TEST_F(CompilerTest, HlslOffsetsOptionDisableRespected) { - compiler_.SetHlslOffsets(false); - const auto words = - SimpleCompilationBinary(kGlslShaderWeirdPacking, EShLangVertex); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpMemberDecorate %B 1 Offset 16")) - << disassembly; -} - -TEST_F(CompilerTest, HlslOffsetsOptionEnableRespected) { - compiler_.SetHlslOffsets(true); - const auto words = - SimpleCompilationBinary(kGlslShaderWeirdPacking, EShLangVertex); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpMemberDecorate %B 1 Offset 4")) - << disassembly; -} - -TEST_F(CompilerTest, HlslLegalizationEnabledNoSizeOpt) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::HLSL); - const auto words = - SimpleCompilationBinary(kHlslShaderForLegalizationTest, EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, Not(HasSubstr("OpFunctionCall"))) << disassembly; - EXPECT_THAT(disassembly, HasSubstr("OpName")) << disassembly; -} - -TEST_F(CompilerTest, HlslLegalizationEnabledWithSizeOpt) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::HLSL); - compiler_.SetOptimizationLevel(Compiler::OptimizationLevel::Size); - const auto words = - SimpleCompilationBinary(kHlslShaderForLegalizationTest, EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, Not(HasSubstr("OpFunctionCall"))) << disassembly; - EXPECT_THAT(disassembly, Not(HasSubstr("OpName"))) << disassembly; -} - -TEST_F(CompilerTest, HlslLegalizationDisabled) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::HLSL); - compiler_.EnableHlslLegalization(false); - const auto words = - SimpleCompilationBinary(kHlslShaderForLegalizationTest, EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpFunctionCall")) << disassembly; -} - -TEST_F(CompilerTest, HlslFunctionality1Enabled) { - compiler_.SetSourceLanguage(Compiler::SourceLanguage::HLSL); - compiler_.EnableHlslFunctionality1(true); - compiler_.SetAutoBindUniforms(true); // Counter variable needs a binding. - const auto words = - SimpleCompilationBinary(kHlslShaderWithCounterBuffer, EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, - HasSubstr("OpExtension \"SPV_GOOGLE_hlsl_functionality1\"")) - << disassembly; - EXPECT_THAT(disassembly, - HasSubstr("OpDecorateString %_entryPointOutput " - "UserSemantic \"SV_TARGET0\"")) - << disassembly; -} - -TEST_F(CompilerTest, ClampMapsToFClampByDefault) { - const auto words = - SimpleCompilationBinary(kGlslShaderWithClamp, EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpExtInst %v4float %1 FClamp")) - << disassembly; -} - -TEST_F(CompilerTest, ClampMapsToFClampWithNanClamp) { - compiler_.SetNanClamp(true); - const auto words = - SimpleCompilationBinary(kGlslShaderWithClamp, EShLangFragment); - const auto disassembly = Disassemble(words); - EXPECT_THAT(disassembly, HasSubstr("OpExtInst %v4float %1 NClamp")) - << disassembly; -} - -// A test coase for Glslang -// expected vector after the conversion. -struct GetGlslangClientInfoCase { - std::string prefix; - Compiler::TargetEnv env; - Compiler::TargetEnvVersion env_version; - Compiler::SpirvVersion spv_version; - bool spv_forced; - // Expected results. The error field is matched as a substring. - GlslangClientInfo expected; -}; - -// Test the shaderc_util::GetGlslangClientInfo function. -using GetGlslangClientInfoTest = - testing::TestWithParam; - -TEST_P(GetGlslangClientInfoTest, Sample) { - const auto& c = GetParam(); - const auto& expected = c.expected; - auto result = shaderc_util::GetGlslangClientInfo( - c.prefix, c.env, c.env_version, c.spv_version, c.spv_forced); - - EXPECT_THAT(result.error.empty(), Eq(expected.error.empty())); - if (result.error.empty()) { - EXPECT_THAT(result.client, Eq(expected.client)); - EXPECT_THAT(result.client_version, Eq(expected.client_version)); - EXPECT_THAT(result.target_language, Eq(expected.target_language)); - EXPECT_THAT(result.target_language_version, - Eq(expected.target_language_version)); - } else { - EXPECT_THAT(result.error, HasSubstr(expected.error)); - } -} - -#define CASE_VK(VKVER, SPVVER) \ - "", Compiler::TargetEnv::Vulkan, Compiler::TargetEnvVersion::Vulkan_##VKVER, \ - Compiler::SpirvVersion::v##SPVVER - -#define BADCASE_VK(STR, VKVER, SPVVER) \ - STR, Compiler::TargetEnv::Vulkan, \ - static_cast(VKVER), \ - static_cast(SPVVER) - -#define CASE_GL(GLVER, SPVVER) \ - "", Compiler::TargetEnv::OpenGL, Compiler::TargetEnvVersion::OpenGL_##GLVER, \ - Compiler::SpirvVersion::v##SPVVER - -#define BADCASE_GL(STR, GLVER, SPVVER) \ - STR, Compiler::TargetEnv::OpenGL, \ - static_cast(GLVER), \ - static_cast(SPVVER) - -#define GCASE_VK(STR, VKVER, SPVVER) \ - shaderc_util::GlslangClientInfo { \ - std::string(STR), glslang::EShClientVulkan, \ - glslang::EShTargetVulkan_##VKVER, glslang::EShTargetSpv, \ - glslang::EShTargetSpv_##SPVVER \ - } - -#define GCASE_GL(STR, GLVER, SPVVER) \ - shaderc_util::GlslangClientInfo { \ - std::string(STR), glslang::EShClientOpenGL, \ - glslang::EShTargetOpenGL_##GLVER, glslang::EShTargetSpv, \ - glslang::EShTargetSpv_##SPVVER \ - } - -INSTANTIATE_TEST_SUITE_P( - UnforcedSpirvSuccess, GetGlslangClientInfoTest, - testing::ValuesIn(std::vector{ - // Unforced SPIR-V version. Success cases. - {CASE_VK(1_0, 1_4), false, GCASE_VK("", 1_0, 1_0)}, - {CASE_VK(1_1, 1_4), false, GCASE_VK("", 1_1, 1_3)}, - {CASE_GL(4_5, 1_4), false, GCASE_GL("", 450, 1_0)}, - })); - -INSTANTIATE_TEST_SUITE_P( - ForcedSpirvSuccess, GetGlslangClientInfoTest, - testing::ValuesIn(std::vector{ - // Forced SPIR-V version. Success cases. - {CASE_VK(1_0, 1_0), true, GCASE_VK("", 1_0, 1_0)}, - {CASE_VK(1_0, 1_1), true, GCASE_VK("", 1_0, 1_1)}, - {CASE_VK(1_0, 1_2), true, GCASE_VK("", 1_0, 1_2)}, - {CASE_VK(1_0, 1_3), true, GCASE_VK("", 1_0, 1_3)}, - {CASE_VK(1_1, 1_0), true, GCASE_VK("", 1_1, 1_0)}, - {CASE_VK(1_1, 1_1), true, GCASE_VK("", 1_1, 1_1)}, - {CASE_VK(1_1, 1_2), true, GCASE_VK("", 1_1, 1_2)}, - {CASE_VK(1_1, 1_3), true, GCASE_VK("", 1_1, 1_3)}, - {CASE_GL(4_5, 1_0), true, GCASE_GL("", 450, 1_0)}, - {CASE_GL(4_5, 1_1), true, GCASE_GL("", 450, 1_1)}, - {CASE_GL(4_5, 1_2), true, GCASE_GL("", 450, 1_2)}, - })); - -INSTANTIATE_TEST_SUITE_P( - Failure, GetGlslangClientInfoTest, - testing::ValuesIn(std::vector{ - // Failure cases. - {BADCASE_VK("foo", 999, Compiler::SpirvVersion::v1_0), false, - GCASE_VK("error:foo: Invalid target client version 999 for Vulkan " - "environment 0", - 1_0, 1_0)}, - {BADCASE_GL("foo", 999, Compiler::SpirvVersion::v1_0), false, - GCASE_GL("error:foo: Invalid target client version 999 for OpenGL " - "environment 1", - 450, 1_0)}, - // For bad SPIR-V versions, have to force=true to make it pay attention. - {BADCASE_VK("foo", Compiler::TargetEnvVersion::Vulkan_1_0, 999), true, - GCASE_VK("error:foo: Unknown SPIR-V version 3e7", 1_0, 1_0)}, - {BADCASE_GL("foo", Compiler::TargetEnvVersion::OpenGL_4_5, 999), true, - GCASE_GL("error:foo: Unknown SPIR-V version 3e7", 450, 1_0)}, - })); - -#undef CASE_VK -#undef CASE_GL -#undef BADCASE_VK -#undef BADCASE_GL -#undef GCASE_VK -#undef GCASE_GL -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/src/counting_includer_test.cc b/lib/shaderc/libshaderc_util/src/counting_includer_test.cc deleted file mode 100644 index fbac4417b..000000000 --- a/lib/shaderc/libshaderc_util/src/counting_includer_test.cc +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/counting_includer.h" - -#include -#include - -#include - -namespace { - -// A trivial implementation of CountingIncluder's virtual methods, so tests can -// instantiate. -class ConcreteCountingIncluder : public shaderc_util::CountingIncluder { - public: - using IncludeResult = glslang::TShader::Includer::IncludeResult; - ~ConcreteCountingIncluder() { - // Avoid leaks. - for (auto result : results_) { - release_delegate(result); - } - } - virtual IncludeResult* include_delegate( - const char* requested, const char* requestor, IncludeType, - size_t) override { - const char kError[] = "Unexpected #include"; - results_.push_back(new IncludeResult{"", kError, strlen(kError), nullptr}); - return results_.back(); - } - virtual void release_delegate(IncludeResult* include_result) override { - delete include_result; - } - - private: - // All the results we've returned so far. - std::vector results_; -}; - -TEST(CountingIncluderTest, InitialCount) { - EXPECT_EQ(0, ConcreteCountingIncluder().num_include_directives()); -} - -TEST(CountingIncluderTest, OneIncludeLocal) { - ConcreteCountingIncluder includer; - includer.includeLocal("random file name", "from me", 0); - EXPECT_EQ(1, includer.num_include_directives()); -} - -TEST(CountingIncluderTest, TwoIncludesAnyIncludeType) { - ConcreteCountingIncluder includer; - includer.includeSystem("name1", "from me", 0); - includer.includeLocal("name2", "me", 0); - EXPECT_EQ(2, includer.num_include_directives()); -} - -TEST(CountingIncluderTest, ManyIncludes) { - ConcreteCountingIncluder includer; - for (int i = 0; i < 100; ++i) { - includer.includeLocal("filename", "from me", i); - includer.includeSystem("filename", "from me", i); - } - EXPECT_EQ(200, includer.num_include_directives()); -} - -#ifndef SHADERC_DISABLE_THREADED_TESTS -TEST(CountingIncluderTest, ThreadedIncludes) { - ConcreteCountingIncluder includer; - std::thread t1( - [&includer]() { includer.includeLocal("name1", "me", 0); }); - std::thread t2( - [&includer]() { includer.includeSystem("name2", "me", 1); }); - std::thread t3( - [&includer]() { includer.includeLocal("name3", "me", 2); }); - t1.join(); - t2.join(); - t3.join(); - EXPECT_EQ(3, includer.num_include_directives()); -} -#endif // SHADERC_DISABLE_THREADED_TESTS - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/src/death_test.h b/lib/shaderc/libshaderc_util/src/death_test.h deleted file mode 100644 index d672f130d..000000000 --- a/lib/shaderc/libshaderc_util/src/death_test.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef LIBSHADERC_UTIL_SRC_DEATH_TEST_H -#define LIBSHADERC_UTIL_SRC_DEATH_TEST_H - -#ifdef NDEBUG -#define EXPECT_DEBUG_DEATH_IF_SUPPORTED(statement, regexp) -#else -#define EXPECT_DEBUG_DEATH_IF_SUPPORTED(statement, regexp) \ - EXPECT_DEATH_IF_SUPPORTED(statement, regexp) -#endif - -#endif // LIBSHADERC_UTIL_SRC_DEATH_TEST_H diff --git a/lib/shaderc/libshaderc_util/src/file_finder.cc b/lib/shaderc/libshaderc_util/src/file_finder.cc deleted file mode 100644 index d25c61140..000000000 --- a/lib/shaderc/libshaderc_util/src/file_finder.cc +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/file_finder.h" -#include "libshaderc_util/string_piece.h" - -#include -#include -#include - -namespace { - -// Returns "" if path is empty or ends in '/'. Otherwise, returns "/". -std::string MaybeSlash(const shaderc_util::string_piece& path) { - return (path.empty() || path.back() == '/') ? "" : "/"; -} - -} // anonymous namespace - -namespace shaderc_util { - -std::string FileFinder::FindReadableFilepath( - const std::string& filename) const { - assert(!filename.empty()); - static const auto for_reading = std::ios_base::in; - std::filebuf opener; - for (const auto& prefix : search_path_) { - const std::string prefixed_filename = - prefix + MaybeSlash(prefix) + filename; - if (opener.open(prefixed_filename, for_reading)) return prefixed_filename; - } - return ""; -} - -std::string FileFinder::FindRelativeReadableFilepath( - const std::string& requesting_file, const std::string& filename) const { - assert(!filename.empty()); - - string_piece dir_name(requesting_file); - - size_t last_slash = requesting_file.find_last_of("/\\"); - if (last_slash != std::string::npos) { - dir_name = string_piece(requesting_file.c_str(), - requesting_file.c_str() + last_slash); - } - - if (dir_name.size() == requesting_file.size()) { - dir_name.clear(); - } - - static const auto for_reading = std::ios_base::in; - std::filebuf opener; - const std::string relative_filename = - dir_name.str() + MaybeSlash(dir_name) + filename; - if (opener.open(relative_filename, for_reading)) return relative_filename; - - return FindReadableFilepath(filename); -} - -} // namespace shaderc_util diff --git a/lib/shaderc/libshaderc_util/src/file_finder_test.cc b/lib/shaderc/libshaderc_util/src/file_finder_test.cc deleted file mode 100644 index 607af43ca..000000000 --- a/lib/shaderc/libshaderc_util/src/file_finder_test.cc +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/file_finder.h" - -#include - -// We need getcwd -#if WIN32 -#include -#else -#include -#endif - -#include "death_test.h" - - -namespace { - -using shaderc_util::FileFinder; - -// Returns the absolute path of the current working directory. -std::string GetCurrentDir() { - // Provide generous space to write the path. - char buf[1000]; -#if WIN32 - return _getcwd(buf, sizeof(buf)); -#else - return getcwd(buf, sizeof(buf)); -#endif -} - -class FileFinderTest : public testing::Test { - protected: - FileFinder finder; - // Absolute path of the current working directory. - const std::string current_dir = GetCurrentDir(); -}; - -TEST_F(FileFinderTest, PathStartsEmpty) { - EXPECT_TRUE(FileFinder().search_path().empty()); -} - -TEST_F(FileFinderTest, EmptyPath) { - finder.search_path().clear(); - EXPECT_EQ("", finder.FindReadableFilepath("include_file.1")); -} - -TEST_F(FileFinderTest, EmptyStringInPath) { - finder.search_path() = {""}; - EXPECT_EQ("include_file.1", finder.FindReadableFilepath("include_file.1")); - EXPECT_EQ("dir/subdir/include_file.2", - finder.FindReadableFilepath("dir/subdir/include_file.2")); -} - -TEST_F(FileFinderTest, SimplePath) { - finder.search_path() = {"dir"}; - EXPECT_EQ("dir/subdir/include_file.2", - finder.FindReadableFilepath("subdir/include_file.2")); -} - -TEST_F(FileFinderTest, PathEndsInSlash) { - finder.search_path() = {"dir/"}; - EXPECT_EQ("dir/subdir/include_file.2", - finder.FindReadableFilepath("subdir/include_file.2")); -} - -TEST_F(FileFinderTest, ParentDir) { - finder.search_path() = {"dir"}; - EXPECT_EQ("dir/../include_file.1", - finder.FindReadableFilepath("../include_file.1")); -} - -TEST_F(FileFinderTest, EntirePathIsActive) { - finder.search_path() = {"", "dir/subdir/"}; - EXPECT_EQ("include_file.1", finder.FindReadableFilepath("include_file.1")); - EXPECT_EQ("dir/subdir/include_file.2", - finder.FindReadableFilepath("include_file.2")); -} - -TEST_F(FileFinderTest, NonExistingFile) { - finder.search_path() = {"", "dir/subdir/"}; - EXPECT_EQ("", finder.FindReadableFilepath("garbage.xyxyxyxyxyxz")); -} - -TEST_F(FileFinderTest, FirstHitReturned) { - finder.search_path() = {".", "", "dir/../"}; - EXPECT_EQ("./include_file.1", finder.FindReadableFilepath("include_file.1")); -} - -TEST_F(FileFinderTest, IrrelevantPaths) { - finder.search_path() = {".", "garbage.xyxyxyxyxyz", "dir/../"}; - EXPECT_EQ("", finder.FindReadableFilepath("include_file.2")); - finder.search_path().push_back("dir/subdir"); - EXPECT_EQ("dir/subdir/include_file.2", - finder.FindReadableFilepath("include_file.2")); -} - -TEST_F(FileFinderTest, CurrentDirectory) { - ASSERT_GE(current_dir.size(), 0u); - // Either the directory should start with / (if we are on Linux), - // Or it should beither X:/ or X:\ or // (if we are on Windows). - ASSERT_TRUE(current_dir.front() == '\\' || current_dir.front() == '/' || - (current_dir.size() >= 3u && current_dir[1] == ':' && - (current_dir[2] == '\\' || current_dir[2] == '/'))); -} - -TEST_F(FileFinderTest, AbsolutePath) { - ASSERT_NE('/', current_dir.back()); - finder.search_path() = {current_dir}; - EXPECT_EQ(current_dir + "/include_file.1", - finder.FindReadableFilepath("include_file.1")); - EXPECT_EQ(current_dir + "/dir/subdir/include_file.2", - finder.FindReadableFilepath("dir/subdir/include_file.2")); -} - -TEST_F(FileFinderTest, AbsoluteFilename) { - ASSERT_NE('/', current_dir.back()); - - finder.search_path() = {""}; - const std::string absolute_file1 = current_dir + "/include_file.1"; - EXPECT_EQ(absolute_file1, finder.FindReadableFilepath(absolute_file1)); - EXPECT_EQ("", finder.FindReadableFilepath("/dir/subdir/include_file.2")); - - finder.search_path().push_back("."); - EXPECT_EQ(".//dir/subdir/include_file.2", - finder.FindReadableFilepath("/dir/subdir/include_file.2")); -} - -TEST(FileFinderDeathTest, EmptyFilename) { - EXPECT_DEBUG_DEATH_IF_SUPPORTED(FileFinder().FindReadableFilepath(""), - "Assertion"); -} - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/src/format_test.cc b/lib/shaderc/libshaderc_util/src/format_test.cc deleted file mode 100644 index c0d6e3991..000000000 --- a/lib/shaderc/libshaderc_util/src/format_test.cc +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/format.h" - -#include -#include -#include -#include - -namespace { - -using testing::AllOf; -using testing::HasSubstr; -using testing::IsEmpty; - -class FormatMap : public testing::Test { - public: - FormatMap() - : map1({{"one", 1}}), - umap1({map1.begin(), map1.end()}), - map8({{1, "one"}, - {2, "two"}, - {3, "three"}, - {4, "four"}, - {5, "five"}, - {6, "six"}, - {7, "seven"}, - {8, "eight"}}), - umap8({map8.begin(), map8.end()}), - mmap({{1, 100}, {1, 200}, {2, 100}, {2, 200}}), - ummap({mmap.begin(), mmap.end()}) {} - - protected: - std::map empty_map; - std::unordered_map empty_umap; - std::map map1; - std::unordered_map umap1; - std::map map8; - std::unordered_map umap8; - std::multimap mmap; - std::unordered_multimap ummap; -}; - -TEST_F(FormatMap, EmptyMap) { - EXPECT_THAT(shaderc_util::format(empty_map, "pre", "in", "post"), IsEmpty()); - EXPECT_THAT(shaderc_util::format(empty_umap, "pre", "in", "post"), IsEmpty()); -} - -TEST_F(FormatMap, SingleEntry) { - EXPECT_EQ("PREoneIN1POST", shaderc_util::format(map1, "PRE", "IN", "POST")); - EXPECT_EQ("PREoneIN1POST", shaderc_util::format(umap1, "PRE", "IN", "POST")); -} - -TEST_F(FormatMap, EmptyPrefix) { - EXPECT_EQ("oneIN1POST", shaderc_util::format(map1, "", "IN", "POST")); - EXPECT_EQ("oneIN1POST", shaderc_util::format(umap1, "", "IN", "POST")); -} - -TEST_F(FormatMap, EmptyInfix) { - EXPECT_EQ("PREone1POST", shaderc_util::format(map1, "PRE", "", "POST")); - EXPECT_EQ("PREone1POST", shaderc_util::format(umap1, "PRE", "", "POST")); -} - -TEST_F(FormatMap, EmptyPostfix) { - EXPECT_EQ("PREoneIN1", shaderc_util::format(map1, "PRE", "IN", "")); - EXPECT_EQ("PREoneIN1", shaderc_util::format(umap1, "PRE", "IN", "")); -} - -TEST_F(FormatMap, LargerMap) { - const std::string result = shaderc_util::format(map8, "", "", "\n"), - uresult = shaderc_util::format(umap8, "", "", "\n"); - auto has_all = - AllOf(HasSubstr("1one\n"), HasSubstr("2two\n"), HasSubstr("3three\n"), - HasSubstr("4four\n"), HasSubstr("5five\n"), HasSubstr("6six\n"), - HasSubstr("7seven\n"), HasSubstr("8eight\n")); - EXPECT_THAT(result, has_all); - EXPECT_EQ(48u, result.size()); - EXPECT_THAT(uresult, has_all); - EXPECT_EQ(48u, uresult.size()); -} - -TEST_F(FormatMap, Multimap) { - const std::string result = shaderc_util::format(mmap, " ", "&", ""), - uresult = shaderc_util::format(ummap, " ", "&", ""); - auto has_all = AllOf(HasSubstr(" 1&100"), HasSubstr(" 1&200"), - HasSubstr(" 2&100"), HasSubstr(" 2&200")); - EXPECT_THAT(result, has_all); - EXPECT_EQ(4 * 6u, result.size()); - EXPECT_THAT(uresult, has_all); - EXPECT_EQ(4 * 6u, uresult.size()); -} - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/src/io_shaderc.cc b/lib/shaderc/libshaderc_util/src/io_shaderc.cc deleted file mode 100644 index dc2a53af9..000000000 --- a/lib/shaderc/libshaderc_util/src/io_shaderc.cc +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/io_shaderc.h" - -#include "libshaderc_util/universal_unistd.h" - -#if _WIN32 -// Need _fileno from stdio.h -// Need _O_BINARY and _O_TEXT from fcntl.h -#include -#include -#endif - -#include - -#include -#include -#include -#include - -namespace { - -// Outputs a descriptive message for errno_value to cerr. -// This may be truncated to 1023 bytes on certain platforms. -void OutputFileErrorMessage(int errno_value) { -#ifdef _MSC_VER - // If the error message is more than 1023 bytes it will be truncated. - char buffer[1024]; - strerror_s(buffer, errno_value); - std::cerr << ": " << buffer << std::endl; -#else - std::cerr << ": " << strerror(errno_value) << std::endl; -#endif -} - -} // anonymous namespace - -namespace shaderc_util { - -bool IsAbsolutePath(const std::string& path) { - if (path.empty()) return false; - // Unix-like OS: /path/to/file - if (path.front() == '/') return true; - // Windows: \\server\user\file - if (path.size() > 1 && path[0] == '\\' && path[1] == '\\') { - return true; - } - // Windows: X:\path\to\file - if (path.size() > 2 && ::isalpha(path[0]) && path[1] == ':' && - path[2] == '\\') { - return true; - } - return false; -} - -std::string GetBaseFileName(const std::string& file_path) { - size_t loc_slash = file_path.find_last_of("/\\"); - std::string base_name = - file_path.substr((loc_slash == std::string::npos ? -1 : loc_slash) + 1); - if (base_name == ".." || base_name == ".") { - base_name = ""; - } - return base_name; -} - -bool ReadFile(const std::string& input_file_name, - std::vector* input_data) { - std::istream* stream = &std::cin; - std::ifstream input_file; - if (input_file_name != "-") { - input_file.open(input_file_name, std::ios_base::binary); - stream = &input_file; - if (input_file.fail()) { - std::cerr << "glslc: error: cannot open input file: '" << input_file_name - << "'"; - if (access(input_file_name.c_str(), R_OK) != 0) { - OutputFileErrorMessage(errno); - return false; - } - std::cerr << std::endl; - return false; - } - } - *input_data = std::vector((std::istreambuf_iterator(*stream)), - std::istreambuf_iterator()); - return true; -} - -std::ostream* GetOutputStream(const string_piece& output_filename, - std::ofstream* file_stream, std::ostream* err) { - std::ostream* stream = &std::cout; - if (output_filename != "-") { - file_stream->open(output_filename.str(), std::ios_base::binary); - stream = file_stream; - if (file_stream->fail()) { - *err << "glslc: error: cannot open output file: '" << output_filename - << "'"; - if (access(output_filename.str().c_str(), W_OK) != 0) { - OutputFileErrorMessage(errno); - return nullptr; - } - std::cerr << std::endl; - return nullptr; - } - } - return stream; -} - -bool WriteFile(std::ostream* stream, const string_piece& output_data) { - if (output_data.size() > 0) { - stream->write(output_data.data(), output_data.size()); - if (!stream->good()) { - return false; - } - } - stream->flush(); - return true; -} - -void FlushAndSetBinaryModeOnStdout() { - std::fflush(stdout); -#if _WIN32 - _setmode(_fileno(stdout), _O_BINARY); -#endif -} - -void FlushAndSetTextModeOnStdout() { - std::fflush(stdout); -#if _WIN32 - _setmode(_fileno(stdout), _O_TEXT); -#endif -} - -} // namespace shaderc_util diff --git a/lib/shaderc/libshaderc_util/src/io_shaderc_test.cc b/lib/shaderc/libshaderc_util/src/io_shaderc_test.cc deleted file mode 100644 index 638e15e45..000000000 --- a/lib/shaderc/libshaderc_util/src/io_shaderc_test.cc +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/io_shaderc.h" - -#include - -#include - -namespace { - -using shaderc_util::GetBaseFileName; -using shaderc_util::GetOutputStream; -using shaderc_util::IsAbsolutePath; -using shaderc_util::ReadFile; -using shaderc_util::WriteFile; -using testing::Eq; -using testing::HasSubstr; - -std::string ToString(const std::vector& v) { - return std::string(v.data(), v.size()); -} - -class ReadFileTest : public testing::Test { - protected: - // A vector to pass to ReadFile. - std::vector read_data; -}; - -TEST(IsAbsolutePathTest, Linux) { - EXPECT_FALSE(IsAbsolutePath("")); - EXPECT_TRUE(IsAbsolutePath("/")); - EXPECT_FALSE(IsAbsolutePath(".")); - EXPECT_FALSE(IsAbsolutePath("..")); - EXPECT_TRUE(IsAbsolutePath("/bin/echo")); - EXPECT_TRUE(IsAbsolutePath("//etc/shadow")); - EXPECT_TRUE(IsAbsolutePath("/../../../lib")); - EXPECT_FALSE(IsAbsolutePath("./something")); - EXPECT_FALSE(IsAbsolutePath("input")); - EXPECT_FALSE(IsAbsolutePath("../test")); - EXPECT_FALSE(IsAbsolutePath(" /abc")); - EXPECT_TRUE(IsAbsolutePath("/abc def/ttt")); -} - -TEST(IsAbsolutePathTest, Windows) { - EXPECT_TRUE(IsAbsolutePath(R"(\\Server1000\superuser\file)")); - EXPECT_TRUE(IsAbsolutePath(R"(\\zzzz 1000\user with space\file with space)")); - EXPECT_TRUE( - IsAbsolutePath(R"(C:\Program Files (x86)\Windows Folder\shader.glsl)")); - EXPECT_FALSE(IsAbsolutePath(R"(third_party\gmock)")); - EXPECT_FALSE(IsAbsolutePath(R"(C:..\File.txt)")); -} - -TEST(GetBaseFileName, Linux) { - EXPECT_EQ("", GetBaseFileName("")); - EXPECT_EQ("", GetBaseFileName("/")); - EXPECT_EQ("", GetBaseFileName(".")); - EXPECT_EQ("", GetBaseFileName("..")); - EXPECT_EQ("echo", GetBaseFileName("/bin/echo")); - EXPECT_EQ("shadow", GetBaseFileName("//etc/shadow")); - EXPECT_EQ("lib", GetBaseFileName("/../../../lib")); - EXPECT_EQ("something", GetBaseFileName("./something")); - EXPECT_EQ("input", GetBaseFileName("input")); - EXPECT_EQ("test", GetBaseFileName("../test")); - EXPECT_EQ("abc", GetBaseFileName(" /abc")); - EXPECT_EQ("ttt", GetBaseFileName("/abc def/ttt")); -} - -TEST(GetBaseFileName, Windows) { - EXPECT_EQ("file", GetBaseFileName(R"(\\Server1000\superuser\file)")); - EXPECT_EQ("file with space", - GetBaseFileName(R"(\\zzzz 1000\user with space\file with space)")); - EXPECT_EQ( - "shader.glsl", - GetBaseFileName(R"(C:\Program Files (x86)\Windows Folder\shader.glsl)")); - EXPECT_EQ("gmock", GetBaseFileName(R"(third_party\gmock)")); - EXPECT_EQ("File.txt", GetBaseFileName(R"(C:..\File.txt)")); -} - -TEST_F(ReadFileTest, CorrectContent) { - ASSERT_TRUE(ReadFile("include_file.1", &read_data)); - EXPECT_EQ("The quick brown fox jumps over a lazy dog.", ToString(read_data)); -} - -TEST_F(ReadFileTest, EmptyContent) { - ASSERT_TRUE(ReadFile("dir/subdir/include_file.2", &read_data)); - EXPECT_TRUE(read_data.empty()); -} - -TEST_F(ReadFileTest, FileNotFound) { - EXPECT_FALSE(ReadFile("garbage garbage vjoiarhiupo hrfewi", &read_data)); -} - -TEST_F(ReadFileTest, EmptyFilename) { EXPECT_FALSE(ReadFile("", &read_data)); } - -TEST(WriteFiletest, BadStream) { - std::ofstream fstream; - std::ostringstream err; - std::ostream* output_stream = GetOutputStream( - "/this/should/not/be/writable/asdfasdfasdfasdf", &fstream, &err); - EXPECT_EQ(nullptr, output_stream); - EXPECT_TRUE(fstream.fail()); - EXPECT_EQ(nullptr, output_stream); - EXPECT_THAT(err.str(), HasSubstr("cannot open output file")); -} - -TEST(WriteFileTest, Roundtrip) { - const std::string content = "random content 12345"; - const std::string filename = "WriteFileTestOutput.tmp"; - std::ofstream fstream; - std::ostringstream err; - std::ostream* output_stream = GetOutputStream(filename, &fstream, &err); - ASSERT_EQ(output_stream, &fstream); - EXPECT_THAT(err.str(), Eq("")); - ASSERT_TRUE(WriteFile(output_stream, content)); - std::vector read_data; - ASSERT_TRUE(ReadFile(filename, &read_data)); - EXPECT_EQ(content, ToString(read_data)); -} - -TEST(OutputStreamTest, Stdout) { - std::ofstream fstream; - std::ostringstream err; - std::ostream* output_stream = GetOutputStream("-", &fstream, &err); - EXPECT_EQ(&std::cout, output_stream); - EXPECT_THAT(err.str(), Eq("")); -} -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/src/message.cc b/lib/shaderc/libshaderc_util/src/message.cc deleted file mode 100644 index 3604b1ee5..000000000 --- a/lib/shaderc/libshaderc_util/src/message.cc +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/message.h" - -#include -#include -#include -#include - -namespace shaderc_util { - -namespace { - -// Given a message, deduces and returns its type. If the message type is -// recognized, advances *message past the prefix indicating the type. Otherwise, -// leaves *message unchanged and returns MessageType::Unknown. -MessageType DeduceMessageType(string_piece* message) { - static const char kErrorMessage[] = "ERROR: "; - static const char kWarningMessage[] = "WARNING: "; - static const char kGlobalWarningMessage[] = "Warning, "; - - if (message->starts_with(kErrorMessage)) { - *message = message->substr(::strlen(kErrorMessage)); - return MessageType::Error; - } else if (message->starts_with(kWarningMessage)) { - *message = message->substr(::strlen(kWarningMessage)); - return MessageType::Warning; - } else if (message->starts_with(kGlobalWarningMessage)) { - *message = message->substr(::strlen(kGlobalWarningMessage)); - return MessageType::GlobalWarning; - } - return MessageType::Unknown; -} - -// Deduces a location specification from the given message. A location -// specification is of the form "::" and a trailing -// space. If the deduction is successful, returns true and updates source_name -// and line_number to the deduced source name and line numer respectively. The -// prefix standing for the location specification in message is skipped. -// Otherwise, returns false and keeps all parameters untouched. -bool DeduceLocationSpec(string_piece* message, string_piece* source_name, - string_piece* line_number) { - if (!message || message->empty()) { - return false; - } - - // When we find a pattern like this: - // colon - // digits - // colon - // space - // Then deduce that the source_name is the text before the first colon, - // the line number is the digits, and the message is the text after the - // second colon. - - const size_t size = message->size(); - if (size <= 4) { - // A valid message must have a colon, a digit, a colon, and a space. - return false; - } - // The last possible position of the first colon. - const size_t first_colon_cutoff = size - 4; - // The last possible position of the second colon. - const size_t next_colon_cutoff = size - 2; - - for (size_t first_colon_pos = message->find_first_of(':'), next_colon_pos = 0; - - // There is a first colon, and it's not too close to the end - (first_colon_pos != string_piece::npos) && - (first_colon_pos <= first_colon_cutoff); - - // Try the next pair of colons. - first_colon_pos = next_colon_pos) { - // We're guaranteed to have at least 3 more characters. - // Guarantee progress toward the end of the string. - next_colon_pos = message->find_first_of(':', first_colon_pos + 1); - if ((next_colon_pos == string_piece::npos) || - (next_colon_pos > next_colon_cutoff)) { - // No valid solution. - return false; - } - if (first_colon_pos + 1 == next_colon_pos) { - // There is no room for digits. - continue; - } - if ((message->data()[next_colon_pos + 1] != ' ')) { - // There is no space character after the second colon. - continue; - } - if (message->find_first_not_of("0123456789", first_colon_pos + 1) == - next_colon_pos) { - // We found the first solution. - *source_name = message->substr(0, first_colon_pos); - *line_number = message->substr(first_colon_pos + 1, - next_colon_pos - 1 - first_colon_pos); - *message = message->substr(next_colon_pos + 2); - return true; - } - } - - return false; -} - -// Returns true if the given message is a summary message. -bool IsSummaryMessage(const string_piece& message) { - const size_t space_loc = message.find_first_of(' '); - if (space_loc == string_piece::npos) return false; - const string_piece number = message.substr(0, space_loc); - const string_piece rest = message.substr(space_loc + 1); - if (!std::all_of(number.begin(), number.end(), ::isdigit)) return false; - if (!rest.starts_with("compilation errors.")) return false; - return true; -} - -} // anonymous namespace - -MessageType ParseGlslangOutput(const string_piece& message, - bool warnings_as_errors, bool suppress_warnings, - string_piece* source_name, - string_piece* line_number, string_piece* rest) { - string_piece rest_of_message(message); - source_name->clear(); - line_number->clear(); - rest->clear(); - - // The glslang warning/error messages are typically of the following form: - // - // - // can be "WARNING:", "ERROR:", or "Warning, ". "WARNING:" - // means a warning message for a certain line, while "Warning, " means a - // global one. - // - // is of the form: - // :: - // It doesn't exist if the warning/error message is a global one. - // - // See Glslang's TInfoSink class implementation for details. - - bool is_error = false; - - // Handle . - switch (DeduceMessageType(&rest_of_message)) { - case MessageType::Warning: - if (suppress_warnings) return MessageType::Ignored; - break; - case MessageType::Error: - is_error = true; - break; - case MessageType::GlobalWarning: - if (suppress_warnings) return MessageType::Ignored; - *rest = rest_of_message; - return warnings_as_errors ? MessageType::GlobalError - : MessageType::GlobalWarning; - case MessageType::Unknown: - *rest = rest_of_message; - return MessageType::Unknown; - default: - break; - } - - rest_of_message = rest_of_message.strip_whitespace(); - if (rest_of_message.empty()) return MessageType::Unknown; - - // Now we have stripped the . Try to see if we can find - // a . - if (DeduceLocationSpec(&rest_of_message, source_name, line_number)) { - *rest = rest_of_message; - return (is_error || warnings_as_errors) ? MessageType::Error - : MessageType::Warning; - } else { - // No . This is a global warning/error message. - // A special kind of global message is summary message, which should - // start with a number. - *rest = rest_of_message; - if (IsSummaryMessage(rest_of_message)) { - return (is_error || warnings_as_errors) ? MessageType::ErrorSummary - : MessageType::WarningSummary; - } - return (is_error || warnings_as_errors) ? MessageType::GlobalError - : MessageType::GlobalWarning; - } - return MessageType::Unknown; -} - -bool PrintFilteredErrors(const string_piece& file_name, - std::ostream* error_stream, bool warnings_as_errors, - bool suppress_warnings, const char* error_list, - size_t* total_warnings, size_t* total_errors) { - const char* ignored_error_strings[] = { - "Warning, version 310 is not yet complete; most version-specific " - "features are present, but some are missing.", - "Warning, version 400 is not yet complete; most version-specific " - "features are present, but some are missing.", - "Warning, version 410 is not yet complete; most version-specific " - "features are present, but some are missing.", - "Warning, version 420 is not yet complete; most version-specific " - "features are present, but some are missing.", - "Warning, version 430 is not yet complete; most version-specific " - "features are present, but some are missing.", - "Warning, version 440 is not yet complete; most version-specific " - "features are present, but some are missing.", - "Warning, version 450 is not yet complete; most version-specific " - "features are present, but some are missing.", - "Linked vertex stage:", "Linked fragment stage:", - "Linked tessellation control stage:", - "Linked tessellation evaluation stage:", "Linked geometry stage:", - "Linked compute stage:", ""}; - size_t existing_total_errors = *total_errors; - string_piece error_messages(error_list); - for (const string_piece& message : error_messages.get_fields('\n')) { - if (std::find(std::begin(ignored_error_strings), - std::end(ignored_error_strings), - message) == std::end(ignored_error_strings)) { - string_piece source_name; - string_piece line_number; - string_piece rest; - const MessageType type = - ParseGlslangOutput(message, warnings_as_errors, suppress_warnings, - &source_name, &line_number, &rest); - string_piece name = file_name; - if (!source_name.empty()) { - // -1 is the string number for the preamble injected by us. - name = source_name == "-1" ? "" : source_name; - } - switch (type) { - case MessageType::Error: - case MessageType::Warning: - assert(!name.empty() && !line_number.empty() && !rest.empty()); - *error_stream << name << ":" << line_number << ": " - << (type == MessageType::Error ? "error: " - : "warning: ") - << rest.strip_whitespace() << std::endl; - *total_errors += type == MessageType::Error; - *total_warnings += type == MessageType::Warning; - break; - case MessageType::ErrorSummary: - case MessageType::WarningSummary: - break; - case MessageType::GlobalError: - case MessageType::GlobalWarning: - assert(!rest.empty()); - *total_errors += type == MessageType::GlobalError; - *total_warnings += type == MessageType::GlobalWarning; - *error_stream << name << ": " - << (type == MessageType::GlobalError ? "error" - : "warning") - << ": " << rest.strip_whitespace() << std::endl; - break; - case MessageType::Unknown: - *error_stream << name << ":"; - *error_stream << " " << message << std::endl; - break; - case MessageType::Ignored: - break; - } - } - } - return (existing_total_errors == *total_errors); -} - -// Outputs the number of warnings and errors if there are any. -void OutputMessages(std::ostream* error_stream, size_t total_warnings, - size_t total_errors) { - if (total_warnings > 0 || total_errors > 0) { - if (total_warnings > 0 && total_errors > 0) { - *error_stream << total_warnings << " warning" - << (total_warnings > 1 ? "s" : "") << " and " - << total_errors << " error" << (total_errors > 1 ? "s" : "") - << " generated." << std::endl; - } else if (total_warnings > 0) { - *error_stream << total_warnings << " warning" - << (total_warnings > 1 ? "s" : "") << " generated." - << std::endl; - } else if (total_errors > 0) { - *error_stream << total_errors << " error" << (total_errors > 1 ? "s" : "") - << " generated." << std::endl; - } - } -} - -} // namespace glslc diff --git a/lib/shaderc/libshaderc_util/src/message_test.cc b/lib/shaderc/libshaderc_util/src/message_test.cc deleted file mode 100644 index 26dc26b32..000000000 --- a/lib/shaderc/libshaderc_util/src/message_test.cc +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Some of the tests here check code paths that are not checked by -// integration tests. -// Generally, these would be conditions not generated by the Glslang -// compiler. It's easier to write these unit tests than to inject -// a dependency on a fake compiler. -#include "libshaderc_util/message.h" - -#include - -using shaderc_util::MessageType; -using shaderc_util::ParseGlslangOutput; -using shaderc_util::string_piece; - -namespace { - -TEST(ParseGlslangOutputTest, EmptyMessageBody) { - string_piece segment_number; - string_piece line_number; - string_piece rest; - EXPECT_EQ(MessageType::Unknown, - ParseGlslangOutput("WARNING: ", false, false, &segment_number, - &line_number, &rest)); - EXPECT_EQ(MessageType::Unknown, - ParseGlslangOutput("ERROR: ", false, false, &segment_number, - &line_number, &rest)); -} - -TEST(ParseGlslangOutputTest, GlobalError) { - string_piece segment_number; - string_piece line_number; - string_piece rest; - EXPECT_EQ( - MessageType::GlobalError, - ParseGlslangOutput("ERROR: too many functions: got 1666473 of them", - false, false, &segment_number, &line_number, &rest)); - EXPECT_EQ("too many functions: got 1666473 of them", rest.str()); - - EXPECT_EQ( - MessageType::GlobalError, - ParseGlslangOutput( - "ERROR: #version: versions before 150 do not allow a profile token", - false, false, &segment_number, &line_number, &rest)); - EXPECT_EQ("#version: versions before 150 do not allow a profile token", - rest.str()); -} - -TEST(ParseGlslangOutputTest, GlobalWarning) { - string_piece segment_number; - string_piece line_number; - string_piece rest; - EXPECT_EQ(MessageType::GlobalWarning, - ParseGlslangOutput("Warning, version 1000 is unknown.", false, - false, &segment_number, &line_number, &rest)); - EXPECT_EQ("version 1000 is unknown.", rest.str()); -} - -TEST(ParseGlslangOutputTest, InvalidSuffixAfterSegmentNumber) { - string_piece segment_number; - string_piece line_number; - string_piece rest; - EXPECT_EQ(MessageType::GlobalWarning, - ParseGlslangOutput("WARNING: 12a", false, false, &segment_number, - &line_number, &rest)); - EXPECT_EQ(MessageType::GlobalError, - ParseGlslangOutput("WARNING: 12a", true, false, &segment_number, - &line_number, &rest)); - EXPECT_EQ(MessageType::GlobalError, - ParseGlslangOutput("ERROR: 42!", false, false, &segment_number, - &line_number, &rest)); -} - -TEST(ParseGlslangOutputTest, OnlyANumber) { - string_piece source_name; - string_piece line_number; - string_piece rest; - EXPECT_EQ(MessageType::GlobalWarning, - ParseGlslangOutput("WARNING: 12", false, false, &source_name, - &line_number, &rest)); - EXPECT_TRUE(source_name.empty()); - EXPECT_TRUE(line_number.empty()); - EXPECT_EQ("12", rest.str()); - - EXPECT_EQ(MessageType::GlobalError, - ParseGlslangOutput("WARNING: 12", true, false, &source_name, - &line_number, &rest)); - EXPECT_TRUE(source_name.empty()); - EXPECT_TRUE(line_number.empty()); - EXPECT_EQ("12", rest.str()); - - EXPECT_EQ(MessageType::GlobalError, - ParseGlslangOutput("ERROR: 42", false, false, &source_name, - &line_number, &rest)); - EXPECT_TRUE(source_name.empty()); - EXPECT_TRUE(line_number.empty()); - EXPECT_EQ("42", rest.str()); -} - -TEST(ParseGlslangOutputTest, InvalidSuffixAfterSegmentNumberColon) { - string_piece segment_number; - string_piece line_number; - string_piece rest; - EXPECT_EQ(MessageType::GlobalWarning, - ParseGlslangOutput("WARNING: 12:0", false, false, &segment_number, - &line_number, &rest)); - EXPECT_EQ(MessageType::GlobalError, - ParseGlslangOutput("ERROR: 42:1234", false, false, &segment_number, - &line_number, &rest)); -} - -TEST(ParseGlslangOutputTest, CompletelyUnrecognized) { - string_piece segment_number; - string_piece line_number; - string_piece rest; - EXPECT_EQ(MessageType::Unknown, - ParseGlslangOutput("hello world!", false, false, &segment_number, - &line_number, &rest)); -} - -TEST(ParseGlslangOutputTest, LocationSpecification) { - string_piece segment_number; - string_piece line_number; - string_piece rest; - - // Glslang reading from strings can give string segment numbers as - // the filename part. - EXPECT_EQ( - MessageType::Error, - ParseGlslangOutput("ERROR: 0:2: '#' : invalid directive: foo", false, - false, &segment_number, &line_number, &rest)); - EXPECT_EQ("0", segment_number.str()); - EXPECT_EQ("2", line_number.str()); - EXPECT_EQ("'#' : invalid directive: foo", rest.str()); - - EXPECT_EQ( - MessageType::Warning, - ParseGlslangOutput("WARNING: 15:36: The following extension must be " - "enabled to use this feature:", - false, false, &segment_number, &line_number, &rest)); - EXPECT_EQ("15", segment_number.str()); - EXPECT_EQ("36", line_number.str()); - EXPECT_EQ("The following extension must be enabled to use this feature:", - rest.str()); -} - -TEST(ParseGlslangOutputTest, FileName_BaseAndExtension) { - string_piece source_name; - string_piece line_number; - string_piece rest; - - EXPECT_EQ(MessageType::Error, - ParseGlslangOutput("ERROR: shader.vert:5: something wrong", false, - false, &source_name, &line_number, &rest)); - EXPECT_EQ("shader.vert", source_name.str()); - EXPECT_EQ("5", line_number.str()); - EXPECT_EQ("something wrong", rest.str()); -} - -TEST(ParseGlslangOutputTest, FileName_BaseOnly) { - string_piece source_name; - string_piece line_number; - string_piece rest; - - EXPECT_EQ(MessageType::Warning, - ParseGlslangOutput("WARNING: file:42: something wrong", false, - false, &source_name, &line_number, &rest)); - EXPECT_EQ("file", source_name.str()); - EXPECT_EQ("42", line_number.str()); - EXPECT_EQ("something wrong", rest.str()); -} - -TEST(ParseGlslangOutputTest, FileName_HexNumber) { - string_piece source_name; - string_piece line_number; - string_piece rest; - - EXPECT_EQ(MessageType::Warning, - ParseGlslangOutput("WARNING: 0xdeedbeef:0: wa:ha:ha", false, false, - &source_name, &line_number, &rest)); - EXPECT_EQ("0xdeedbeef", source_name.str()); - EXPECT_EQ("0", line_number.str()); - EXPECT_EQ("wa:ha:ha", rest.str()); -} - -TEST(ParseGlslangOutputTest, FileName_ContainsColons) { - string_piece source_name; - string_piece line_number; - string_piece rest; - - EXPECT_EQ(MessageType::Warning, - ParseGlslangOutput("WARNING: foo:bar:0: wa:ha:ha", false, false, - &source_name, &line_number, &rest)); - EXPECT_EQ("foo:bar", source_name.str()); - EXPECT_EQ("0", line_number.str()); - EXPECT_EQ("wa:ha:ha", rest.str()); -} - -TEST(ParseGlslangOutputTest, NoFile) { - string_piece source_name; - string_piece line_number; - string_piece rest; - - EXPECT_EQ(MessageType::Warning, - ParseGlslangOutput("WARNING: :12: abc", false, false, &source_name, - &line_number, &rest)); - EXPECT_EQ("", source_name.str()); - EXPECT_EQ("12", line_number.str()); - EXPECT_EQ("abc", rest.str()); -} - -TEST(ParseGlslangOutputTest, NoLineNumber_InferredAsGlobalNoLocation) { - string_piece source_name; - string_piece line_number; - string_piece rest; - - // No solution since there is no room for digits. - EXPECT_EQ(MessageType::GlobalWarning, - ParseGlslangOutput("WARNING: foo:: abc", false, false, - &source_name, &line_number, &rest)); - EXPECT_EQ("", source_name.str()); - EXPECT_EQ("", line_number.str()); - EXPECT_EQ("foo:: abc", rest.str()); -} - -TEST(ParseGlslangOutputTest, NoSpaceAfterColon_InferredAsGlobalNoLocation) { - string_piece source_name; - string_piece line_number; - string_piece rest; - - // No solution since there is no space after the line-number-and-colon. - EXPECT_EQ(MessageType::GlobalWarning, - ParseGlslangOutput("WARNING: foo:12:abc", false, false, - &source_name, &line_number, &rest)); - EXPECT_EQ("", source_name.str()); - EXPECT_EQ("", line_number.str()); - EXPECT_EQ("foo:12:abc", rest.str()); -} - -TEST(ParseGlslangOutputTest, WindowsPath) { - string_piece source_name; - string_piece line_number; - string_piece rest; - - EXPECT_EQ( - MessageType::Error, - ParseGlslangOutput(R"(ERROR: C:\path\to\shader.glsl:5: something wrong)", - false, false, &source_name, &line_number, &rest)); - EXPECT_EQ(R"(C:\path\to\shader.glsl)", source_name.str()); - EXPECT_EQ("5", line_number.str()); - EXPECT_EQ("something wrong", rest.str()); - - EXPECT_EQ( - MessageType::Warning, - ParseGlslangOutput(R"(WARNING: \\path\without\drive.vert:42: BOOM!)", - false, false, &source_name, &line_number, &rest)); - EXPECT_EQ(R"(\\path\without\drive.vert)", source_name.str()); - EXPECT_EQ("42", line_number.str()); - EXPECT_EQ("BOOM!", rest.str()); - - EXPECT_EQ(MessageType::Warning, - ParseGlslangOutput(R"(WARNING: X:\123.456\789:0: wa:ha:ha)", false, - false, &source_name, &line_number, &rest)); - EXPECT_EQ(R"(X:\123.456\789)", source_name.str()); - EXPECT_EQ("0", line_number.str()); - EXPECT_EQ("wa:ha:ha", rest.str()); -} - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/src/mutex_test.cc b/lib/shaderc/libshaderc_util/src/mutex_test.cc deleted file mode 100644 index 189208968..000000000 --- a/lib/shaderc/libshaderc_util/src/mutex_test.cc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/mutex.h" - -#include -#include - -namespace { - -TEST(MutexTest, CanCreateMutex) { - shaderc_util::mutex mutex; - mutex.lock(); - mutex.unlock(); -} - -#ifndef SHADERC_DISABLE_THREADED_TESTS - -void increment_by_1000(shaderc_util::mutex& mut, int& i) { - for(size_t j = 0; j < 1000; ++j) { - mut.lock(); - i = i + 1; - mut.unlock(); - } -} - -TEST(MutexTest, MutexLocks) { - shaderc_util::mutex mutex; - int i = 0; - std::thread t1([&mutex, &i]() { increment_by_1000(mutex, i); }); - std::thread t2([&mutex, &i]() { increment_by_1000(mutex, i); }); - std::thread t3([&mutex, &i]() { increment_by_1000(mutex, i); }); - t1.join(); - t2.join(); - t3.join(); - EXPECT_EQ(3000, i); -} -#endif // SHADERC_DISABLE_THREADED_TESTS - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/src/resources.cc b/lib/shaderc/libshaderc_util/src/resources.cc deleted file mode 100644 index d64e47fa0..000000000 --- a/lib/shaderc/libshaderc_util/src/resources.cc +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/resources.h" - -#include "glslang/Include/ResourceLimits.h" - -namespace shaderc_util { - -// These numbers come from the OpenGL 4.4 core profile specification Chapter 23 -// unless otherwise specified. -const TBuiltInResource kDefaultTBuiltInResource = { - /*.maxLights = */ 8, // From OpenGL 3.0 table 6.46. - /*.maxClipPlanes = */ 6, // From OpenGL 3.0 table 6.46. - /*.maxTextureUnits = */ 2, // From OpenGL 3.0 table 6.50. - /*.maxTextureCoords = */ 8, // From OpenGL 3.0 table 6.50. - /*.maxVertexAttribs = */ 16, - /*.maxVertexUniformComponents = */ 4096, - /*.maxVaryingFloats = */ 60, // From OpenGLES 3.1 table 6.44. - /*.maxVertexTextureImageUnits = */ 16, - /*.maxCombinedTextureImageUnits = */ 80, - /*.maxTextureImageUnits = */ 16, - /*.maxFragmentUniformComponents = */ 1024, - - // glslang has 32 maxDrawBuffers. - // Pixel phone Vulkan driver in Android N has 8 - // maxFragmentOutputAttachments. - /*.maxDrawBuffers = */ 8, - - /*.maxVertexUniformVectors = */ 256, - /*.maxVaryingVectors = */ 15, // From OpenGLES 3.1 table 6.44. - /*.maxFragmentUniformVectors = */ 256, - /*.maxVertexOutputVectors = */ 16, // maxVertexOutputComponents / 4 - /*.maxFragmentInputVectors = */ 15, // maxFragmentInputComponents / 4 - /*.minProgramTexelOffset = */ -8, - /*.maxProgramTexelOffset = */ 7, - /*.maxClipDistances = */ 8, - /*.maxComputeWorkGroupCountX = */ 65535, - /*.maxComputeWorkGroupCountY = */ 65535, - /*.maxComputeWorkGroupCountZ = */ 65535, - /*.maxComputeWorkGroupSizeX = */ 1024, - /*.maxComputeWorkGroupSizeX = */ 1024, - /*.maxComputeWorkGroupSizeZ = */ 64, - /*.maxComputeUniformComponents = */ 512, - /*.maxComputeTextureImageUnits = */ 16, - /*.maxComputeImageUniforms = */ 8, - /*.maxComputeAtomicCounters = */ 8, - /*.maxComputeAtomicCounterBuffers = */ 1, // From OpenGLES 3.1 Table 6.43 - /*.maxVaryingComponents = */ 60, - /*.maxVertexOutputComponents = */ 64, - /*.maxGeometryInputComponents = */ 64, - /*.maxGeometryOutputComponents = */ 128, - /*.maxFragmentInputComponents = */ 128, - /*.maxImageUnits = */ 8, // This does not seem to be defined anywhere, - // set to ImageUnits. - /*.maxCombinedImageUnitsAndFragmentOutputs = */ 8, - /*.maxCombinedShaderOutputResources = */ 8, - /*.maxImageSamples = */ 0, - /*.maxVertexImageUniforms = */ 0, - /*.maxTessControlImageUniforms = */ 0, - /*.maxTessEvaluationImageUniforms = */ 0, - /*.maxGeometryImageUniforms = */ 0, - /*.maxFragmentImageUniforms = */ 8, - /*.maxCombinedImageUniforms = */ 8, - /*.maxGeometryTextureImageUnits = */ 16, - /*.maxGeometryOutputVertices = */ 256, - /*.maxGeometryTotalOutputComponents = */ 1024, - /*.maxGeometryUniformComponents = */ 512, - /*.maxGeometryVaryingComponents = */ 60, // Does not seem to be defined - // anywhere, set equal to - // maxVaryingComponents. - /*.maxTessControlInputComponents = */ 128, - /*.maxTessControlOutputComponents = */ 128, - /*.maxTessControlTextureImageUnits = */ 16, - /*.maxTessControlUniformComponents = */ 1024, - /*.maxTessControlTotalOutputComponents = */ 4096, - /*.maxTessEvaluationInputComponents = */ 128, - /*.maxTessEvaluationOutputComponents = */ 128, - /*.maxTessEvaluationTextureImageUnits = */ 16, - /*.maxTessEvaluationUniformComponents = */ 1024, - /*.maxTessPatchComponents = */ 120, - /*.maxPatchVertices = */ 32, - /*.maxTessGenLevel = */ 64, - /*.maxViewports = */ 16, - /*.maxVertexAtomicCounters = */ 0, - /*.maxTessControlAtomicCounters = */ 0, - /*.maxTessEvaluationAtomicCounters = */ 0, - /*.maxGeometryAtomicCounters = */ 0, - /*.maxFragmentAtomicCounters = */ 8, - /*.maxCombinedAtomicCounters = */ 8, - /*.maxAtomicCounterBindings = */ 1, - /*.maxVertexAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.41. - - // ARB_shader_atomic_counters. - /*.maxTessControlAtomicCounterBuffers = */ 0, - /*.maxTessEvaluationAtomicCounterBuffers = */ 0, - /*.maxGeometryAtomicCounterBuffers = */ 0, - // /ARB_shader_atomic_counters. - - /*.maxFragmentAtomicCounterBuffers = */ 0, // From OpenGLES 3.1 Table 6.43. - /*.maxCombinedAtomicCounterBuffers = */ 1, - /*.maxAtomicCounterBufferSize = */ 32, - /*.maxTransformFeedbackBuffers = */ 4, - /*.maxTransformFeedbackInterleavedComponents = */ 64, - /*.maxCullDistances = */ 8, // ARB_cull_distance. - /*.maxCombinedClipAndCullDistances = */ 8, // ARB_cull_distance. - /*.maxSamples = */ 4, - /* .maxMeshOutputVerticesNV = */ 256, - /* .maxMeshOutputPrimitivesNV = */ 512, - /* .maxMeshWorkGroupSizeX_NV = */ 32, - /* .maxMeshWorkGroupSizeY_NV = */ 1, - /* .maxMeshWorkGroupSizeZ_NV = */ 1, - /* .maxTaskWorkGroupSizeX_NV = */ 32, - /* .maxTaskWorkGroupSizeY_NV = */ 1, - /* .maxTaskWorkGroupSizeZ_NV = */ 1, - /* .maxMeshViewCountNV = */ 4, - /* .maxDualSourceDrawBuffersEXT = */ 1, - // This is the glslang TLimits structure. - // It defines whether or not the following features are enabled. - // We want them to all be enabled. - /*.limits = */ { - /*.nonInductiveForLoops = */ 1, - /*.whileLoops = */ 1, - /*.doWhileLoops = */ 1, - /*.generalUniformIndexing = */ 1, - /*.generalAttributeMatrixVectorIndexing = */ 1, - /*.generalVaryingIndexing = */ 1, - /*.generalSamplerIndexing = */ 1, - /*.generalVariableIndexing = */ 1, - /*.generalConstantMatrixVectorIndexing = */ 1, - }}; - -} // namespace shaderc_util diff --git a/lib/shaderc/libshaderc_util/src/shader_stage.cc b/lib/shaderc/libshaderc_util/src/shader_stage.cc deleted file mode 100644 index 3122a3d2f..000000000 --- a/lib/shaderc/libshaderc_util/src/shader_stage.cc +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/shader_stage.h" - -namespace { - -// Maps an identifier to a language. -struct LanguageMapping { - const char* id; - EShLanguage language; -}; - -} // anonymous namespace - -namespace shaderc_util { - -EShLanguage MapStageNameToLanguage(const string_piece& stage_name) { - const LanguageMapping string_to_stage[] = { - {"vertex", EShLangVertex}, - {"fragment", EShLangFragment}, - {"tesscontrol", EShLangTessControl}, - {"tesseval", EShLangTessEvaluation}, - {"geometry", EShLangGeometry}, - {"compute", EShLangCompute}, - {"raygen", EShLangRayGenNV}, - {"intersect", EShLangIntersectNV}, - {"anyhit", EShLangAnyHitNV}, - {"closest", EShLangClosestHitNV}, - {"miss", EShLangMissNV}, - {"callable", EShLangCallableNV}, - {"task", EShLangTaskNV}, - {"mesh", EShLangMeshNV}, - }; - - for (const auto& entry : string_to_stage) { - if (stage_name == entry.id) return entry.language; - } - return EShLangCount; -} - -} // namespace shaderc_util diff --git a/lib/shaderc/libshaderc_util/src/spirv_tools_wrapper.cc b/lib/shaderc/libshaderc_util/src/spirv_tools_wrapper.cc deleted file mode 100644 index 63bff6ac7..000000000 --- a/lib/shaderc/libshaderc_util/src/spirv_tools_wrapper.cc +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2016 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/spirv_tools_wrapper.h" - -#include -#include - -#include "spirv-tools/optimizer.hpp" - -namespace shaderc_util { - -namespace { - -// Gets the corresponding target environment used in SPIRV-Tools. -spv_target_env GetSpirvToolsTargetEnv(Compiler::TargetEnv env, - Compiler::TargetEnvVersion version) { - switch (env) { - case Compiler::TargetEnv::Vulkan: - switch (version) { - case Compiler::TargetEnvVersion::Default: - return SPV_ENV_VULKAN_1_0; - case Compiler::TargetEnvVersion::Vulkan_1_0: - return SPV_ENV_VULKAN_1_0; - case Compiler::TargetEnvVersion::Vulkan_1_1: - return SPV_ENV_VULKAN_1_1; - case Compiler::TargetEnvVersion::Vulkan_1_2: - return SPV_ENV_VULKAN_1_2; - case Compiler::TargetEnvVersion::Vulkan_1_3: - return SPV_ENV_VULKAN_1_3; - default: - break; - } - break; - case Compiler::TargetEnv::OpenGL: - return SPV_ENV_OPENGL_4_5; - case Compiler::TargetEnv::OpenGLCompat: - // Errors out before getting here. But the compiler wants us to handle - // enum anyway. - return SPV_ENV_OPENGL_4_5; - } - assert(false && "unexpected target environment or version"); - return SPV_ENV_VULKAN_1_0; -} - -} // anonymous namespace - -bool SpirvToolsDisassemble(Compiler::TargetEnv env, - Compiler::TargetEnvVersion version, - const std::vector& binary, - std::string* text_or_error) { - spvtools::SpirvTools tools(GetSpirvToolsTargetEnv(env, version)); - std::ostringstream oss; - tools.SetMessageConsumer([&oss](spv_message_level_t, const char*, - const spv_position_t& position, - const char* message) { - oss << position.index << ": " << message; - }); - const bool success = - tools.Disassemble(binary, text_or_error, - SPV_BINARY_TO_TEXT_OPTION_INDENT | - SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES); - if (!success) { - *text_or_error = oss.str(); - } - return success; -} - -bool SpirvToolsAssemble(Compiler::TargetEnv env, - Compiler::TargetEnvVersion version, - const string_piece assembly, spv_binary* binary, - std::string* errors) { - auto spvtools_context = - spvContextCreate(GetSpirvToolsTargetEnv(env, version)); - spv_diagnostic spvtools_diagnostic = nullptr; - - *binary = nullptr; - errors->clear(); - - const bool success = - spvTextToBinary(spvtools_context, assembly.data(), assembly.size(), - binary, &spvtools_diagnostic) == SPV_SUCCESS; - if (!success) { - std::ostringstream oss; - oss << spvtools_diagnostic->position.line + 1 << ":" - << spvtools_diagnostic->position.column + 1 << ": " - << spvtools_diagnostic->error; - *errors = oss.str(); - } - - spvDiagnosticDestroy(spvtools_diagnostic); - spvContextDestroy(spvtools_context); - - return success; -} - -bool SpirvToolsOptimize(Compiler::TargetEnv env, - Compiler::TargetEnvVersion version, - const std::vector& enabled_passes, - std::vector* binary, std::string* errors) { - errors->clear(); - if (enabled_passes.empty()) return true; - if (std::all_of( - enabled_passes.cbegin(), enabled_passes.cend(), - [](const PassId& pass) { return pass == PassId::kNullPass; })) { - return true; - } - - spvtools::ValidatorOptions val_opts; - // This allows flexible memory layout for HLSL. - val_opts.SetSkipBlockLayout(true); - // This allows HLSL legalization regarding resources. - val_opts.SetRelaxLogicalPointer(true); - // This uses relaxed rules for pre-legalized HLSL. - val_opts.SetBeforeHlslLegalization(true); - - spvtools::OptimizerOptions opt_opts; - opt_opts.set_validator_options(val_opts); - opt_opts.set_run_validator(true); - - spvtools::Optimizer optimizer(GetSpirvToolsTargetEnv(env, version)); - - std::ostringstream oss; - optimizer.SetMessageConsumer( - [&oss](spv_message_level_t, const char*, const spv_position_t&, - const char* message) { oss << message << "\n"; }); - - for (const auto& pass : enabled_passes) { - switch (pass) { - case PassId::kLegalizationPasses: - optimizer.RegisterLegalizationPasses(); - break; - case PassId::kPerformancePasses: - optimizer.RegisterPerformancePasses(); - break; - case PassId::kSizePasses: - optimizer.RegisterSizePasses(); - break; - case PassId::kNullPass: - // We actually don't need to do anything for null pass. - break; - case PassId::kStripDebugInfo: - optimizer.RegisterPass(spvtools::CreateStripDebugInfoPass()); - break; - case PassId::kCompactIds: - optimizer.RegisterPass(spvtools::CreateCompactIdsPass()); - break; - } - } - - if (!optimizer.Run(binary->data(), binary->size(), binary, opt_opts)) { - *errors = oss.str(); - return false; - } - return true; -} - -} // namespace shaderc_util diff --git a/lib/shaderc/libshaderc_util/src/string_piece_test.cc b/lib/shaderc/libshaderc_util/src/string_piece_test.cc deleted file mode 100644 index 2b75e58e1..000000000 --- a/lib/shaderc/libshaderc_util/src/string_piece_test.cc +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/string_piece.h" - -#include -#include -#include - -#include "death_test.h" - -namespace { - -using shaderc_util::string_piece; - -TEST(string_piece, creation) { - std::string my_string("std::string"); - const char* my_c_string = "c::string"; - - string_piece my_string_piece(my_string); - string_piece my_c_string_piece(my_c_string); - string_piece my_partial_c_string_piece(my_c_string, my_c_string + 3); - string_piece my_string_piece_string_piece(my_string_piece); - - EXPECT_EQ("std::string", my_string_piece); - EXPECT_EQ("c::string", my_c_string_piece); - EXPECT_EQ("c::", my_partial_c_string_piece); - EXPECT_EQ("std::string", my_string_piece_string_piece); -} - -TEST(string_piece, creation_with_empty_data) { - string_piece my_string_piece(nullptr, nullptr); - EXPECT_EQ("", my_string_piece); -} - -TEST(string_piece, creation_with_nullptr) { - string_piece my_string_piece(nullptr); - EXPECT_EQ("", my_string_piece); -} - -TEST(string_pieceDeathTest, creation_causing_assert) { - EXPECT_DEBUG_DEATH_IF_SUPPORTED(string_piece("my_cstring", nullptr), ".*"); - EXPECT_DEBUG_DEATH_IF_SUPPORTED(string_piece(nullptr, "my_cstring"), ".*"); -} - -TEST(string_pieceDeathTest, front) { - EXPECT_DEBUG_DEATH_IF_SUPPORTED(string_piece(nullptr).front(), "Assertion"); - EXPECT_DEBUG_DEATH_IF_SUPPORTED(string_piece(nullptr, nullptr).front(), - "Assertion"); - EXPECT_DEBUG_DEATH_IF_SUPPORTED(string_piece("").front(), "Assertion"); - string_piece s("nonempty"); - s.clear(); - EXPECT_DEBUG_DEATH_IF_SUPPORTED(s.front(), "Assertion"); -} - -TEST(string_pieceDeathTest, back) { - EXPECT_DEBUG_DEATH_IF_SUPPORTED(string_piece(nullptr).back(), "Assertion"); - EXPECT_DEBUG_DEATH_IF_SUPPORTED(string_piece(nullptr, nullptr).back(), - "Assertion"); - EXPECT_DEBUG_DEATH_IF_SUPPORTED(string_piece("").back(), "Assertion"); - string_piece s("nonempty"); - s.clear(); - EXPECT_DEBUG_DEATH_IF_SUPPORTED(s.back(), "Assertion"); -} - -TEST(string_piece, substr) { - string_piece my_string("my really long string"); - EXPECT_EQ("my really long string", my_string.substr(0, string_piece::npos)); - EXPECT_EQ("my really long string", my_string.substr(0)); - EXPECT_EQ("really long string", my_string.substr(3, string_piece::npos)); - EXPECT_EQ("really long string", my_string.substr(3)); - EXPECT_EQ("really", my_string.substr(3, 6)); -} - -TEST(string_piece, length) { - EXPECT_EQ(0u, string_piece().size()); - EXPECT_TRUE(string_piece().empty()); - EXPECT_EQ(10u, string_piece("0123456789").size()); - - std::string my_string("std::string"); - EXPECT_EQ(my_string.size(), string_piece(my_string).size()); -} - -TEST(string_piece, clear) { - string_piece my_string("my really long string"); - EXPECT_EQ("my really long string", my_string); - - string_piece other_string(my_string); - EXPECT_EQ("my really long string", other_string); - - my_string.clear(); - EXPECT_EQ("", my_string); - EXPECT_EQ("my really long string", other_string); -} - -TEST(string_piece, str) { - std::string test_string; - { - std::string temporary_string("my really long string"); - string_piece my_stringpiece(temporary_string); - string_piece my_substring = my_stringpiece.substr(3, 6); - - EXPECT_EQ("really", my_substring); - test_string = my_substring.str(); - } - EXPECT_EQ("really", test_string); -} - -template -bool find_char(char c) { - return c == C; -} - -TEST(string_piece, find_first_not_matching) { - string_piece my_string("aaaaaaa b"); - EXPECT_EQ(7u, my_string.find_first_not_matching(find_char<'a'>)); - EXPECT_EQ(0u, my_string.find_first_not_matching(find_char<'b'>)); - EXPECT_EQ(0u, string_piece(" ").find_first_not_matching(::isdigit)); - size_t npos = string_piece::npos; - EXPECT_EQ(npos, string_piece("").find_first_not_matching(::isdigit)); - EXPECT_EQ(npos, string_piece("123").find_first_not_matching(::isdigit)); - EXPECT_EQ(3u, string_piece("123 ").find_first_not_matching(::isdigit)); -} - -TEST(string_piece, find_first_not_of) { - size_t npos = string_piece::npos; - string_piece my_string("aaaaaaa b"); - EXPECT_EQ(7u, my_string.find_first_not_of("a")); - EXPECT_EQ(0u, my_string.find_first_not_of("b")); - EXPECT_EQ(7u, my_string.find_first_not_of('a')); - EXPECT_EQ(0u, my_string.find_first_not_of('b')); - EXPECT_EQ(0u, string_piece(" ").find_first_not_of("0123456789")); - - EXPECT_EQ(7u, my_string.find_first_not_of("a", 2)); - EXPECT_EQ(2u, my_string.find_first_not_of("b", 2)); - EXPECT_EQ(7u, my_string.find_first_not_of('a', 2)); - EXPECT_EQ(4u, my_string.find_first_not_of('b', 4)); - EXPECT_EQ(0u, string_piece(" ").find_first_not_of("0123456789")); - EXPECT_EQ(npos, string_piece(" ").find_first_not_of("0123456789", 5)); - - EXPECT_EQ(npos, string_piece("").find_first_not_of("012345689")); - EXPECT_EQ(npos, string_piece("").find_first_not_of("012345689", 1)); - EXPECT_EQ(npos, string_piece("123").find_first_not_of("0123456789")); - EXPECT_EQ(npos, string_piece("123").find_first_not_of("0123456789", 1)); - EXPECT_EQ(3u, string_piece("123 ").find_first_not_of("0123456789", 2)); - EXPECT_EQ(npos, string_piece("123 ").find_first_not_of("0123456789", 4)); - EXPECT_EQ(npos, string_piece("").find_first_not_of("1")); - EXPECT_EQ(npos, string_piece("111").find_first_not_of('1')); -} - -TEST(string_piece, find_first_of_char) { - const size_t npos = string_piece::npos; - string_piece my_string("my really long string"); - EXPECT_EQ(0u, my_string.find_first_of('m')); - EXPECT_EQ(3u, my_string.find_first_of('r')); - EXPECT_EQ(npos, my_string.find_first_of('z')); - - size_t pos = my_string.find_first_of('l'); - EXPECT_EQ(6u, pos); - // If pos points to a 'l' then we should just find that one - EXPECT_EQ(6u, my_string.find_first_of('l', pos)); - EXPECT_EQ(7u, my_string.find_first_of('l', pos + 1)); - EXPECT_EQ(10u, my_string.find_first_of('l', pos + 2)); - EXPECT_EQ(npos, my_string.find_first_of('l', pos + 5)); - EXPECT_EQ(npos, my_string.find_first_of('z', 0)); - EXPECT_EQ(npos, my_string.find_first_of('z', npos)); - - my_string.clear(); - EXPECT_EQ(npos, my_string.find_first_of('a')); - EXPECT_EQ(npos, my_string.find_first_of('a', 0)); -} - -TEST(string_piece, find_first_of) { - string_piece my_string("aaaaaa b"); - EXPECT_EQ(0u, my_string.find_first_of("a")); - EXPECT_EQ(7u, my_string.find_first_of("b")); - EXPECT_EQ(6u, my_string.find_first_of(" ")); - size_t npos = string_piece::npos; - EXPECT_EQ(npos, my_string.find_first_of("xh")); - EXPECT_EQ(6u, my_string.find_first_of(" x")); - EXPECT_EQ(6u, my_string.find_first_of(" b")); - EXPECT_EQ(0u, my_string.find_first_of("ab")); - - EXPECT_EQ(6u, my_string.find_first_of(" x", 2)); - EXPECT_EQ(6u, my_string.find_first_of(" b", 2)); - EXPECT_EQ(2u, my_string.find_first_of("ab", 2)); - EXPECT_EQ(npos, my_string.find_first_of("ab", 10)); - - EXPECT_EQ(npos, my_string.find_first_of("c")); - EXPECT_EQ(npos, my_string.find_first_of("c", 1)); - EXPECT_EQ(npos, string_piece(" ").find_first_of("a")); - EXPECT_EQ(npos, string_piece(" ").find_first_of("a", 10)); - EXPECT_EQ(npos, string_piece("aa").find_first_of("")); - EXPECT_EQ(npos, string_piece("aa").find_first_of("", 1)); - EXPECT_EQ(npos, string_piece("").find_first_of("")); - EXPECT_EQ(npos, string_piece("").find_first_of("", 1)); - EXPECT_EQ(npos, string_piece("").find_first_of("a")); - EXPECT_EQ(npos, string_piece("").find_first_of("ae")); - EXPECT_EQ(npos, string_piece("").find_first_of("ae", 32)); -} - -TEST(string_piece, find_last_of) { - string_piece my_string("aaaaaa b"); - EXPECT_EQ(5u, my_string.find_last_of('a')); - EXPECT_EQ(7u, my_string.find_last_of('b')); - EXPECT_EQ(6u, my_string.find_last_of(' ')); - EXPECT_EQ(5u, my_string.find_last_of("a")); - EXPECT_EQ(7u, my_string.find_last_of("b")); - EXPECT_EQ(6u, my_string.find_last_of(" ")); - size_t npos = string_piece::npos; - EXPECT_EQ(npos, my_string.find_last_of("xh")); - EXPECT_EQ(6u, my_string.find_last_of(" x")); - EXPECT_EQ(7u, my_string.find_last_of(" b")); - EXPECT_EQ(7u, my_string.find_last_of("ab")); - - EXPECT_EQ(4u, my_string.find_last_of('a', 4)); - EXPECT_EQ(5u, my_string.find_last_of('a', 6)); - EXPECT_EQ(0u, string_piece("abbbaa").find_last_of('a', 3)); - EXPECT_EQ(4u, string_piece("abbbaa").find_last_of('a', 4)); - EXPECT_EQ(5u, string_piece("abbbaa").find_last_of('a', 5)); - EXPECT_EQ(5u, string_piece("abbbaa").find_last_of('a', 6)); - EXPECT_EQ(npos, string_piece("abbbaa").find_last_of('c', 2)); - - EXPECT_EQ(npos, my_string.find_last_of("c")); - EXPECT_EQ(npos, string_piece(" ").find_last_of("a")); - EXPECT_EQ(npos, string_piece("aa").find_last_of("")); - EXPECT_EQ(npos, string_piece("").find_last_of("")); - EXPECT_EQ(npos, string_piece("").find_last_of("a")); - EXPECT_EQ(npos, my_string.find_last_of('c')); - EXPECT_EQ(npos, string_piece(" ").find_last_of('a')); - EXPECT_EQ(npos, string_piece("").find_last_of('a')); - EXPECT_EQ(npos, string_piece("").find_last_of("ae")); -} - -TEST(string_piece, begin_end) { - const char* my_string = "my really long string"; - string_piece p(my_string); - size_t pos = 0; - for (auto it = p.begin(); it != p.end(); ++it) { - EXPECT_EQ(my_string[pos++], *it); - } - pos = 0; - for (auto c : p) { - EXPECT_EQ(my_string[pos++], c); - } -} - -TEST(string_piece, front_back) { - // EXPECT_TRUE() is used here because gtest will think we are comparing - // between pointer and integer here if EXPECT_EQ() is used. - const string_piece one_char("a"); - EXPECT_TRUE(one_char.front() == 'a'); - EXPECT_TRUE(one_char.back() == 'a'); - - const string_piece two_chars("bc"); - EXPECT_TRUE(two_chars.front() == 'b'); - EXPECT_TRUE(two_chars.back() == 'c'); - - const string_piece multi_chars("w vm g gg t\t"); - EXPECT_TRUE(multi_chars.front() == 'w'); - EXPECT_TRUE(multi_chars.back() == '\t'); -} - -TEST(string_piece, starts_with) { - EXPECT_TRUE(string_piece("my string").starts_with("my")); - EXPECT_TRUE(string_piece("my string").starts_with("my s")); - EXPECT_TRUE(string_piece("my string").starts_with("m")); - EXPECT_TRUE(string_piece("my string").starts_with("")); - EXPECT_TRUE(string_piece("my string").starts_with("my string")); - EXPECT_TRUE(string_piece("").starts_with("")); - - EXPECT_FALSE(string_piece("").starts_with("a")); - EXPECT_FALSE(string_piece("my string").starts_with(" ")); - EXPECT_FALSE(string_piece("my string").starts_with("my stq")); - EXPECT_FALSE(string_piece("my string").starts_with("a")); - EXPECT_FALSE(string_piece("my string").starts_with("my strings")); -} - -TEST(string_piece, find) { - const size_t npos = string_piece::npos; - string_piece my_string("gooogle gooogle"); - - EXPECT_EQ(0u, my_string.find("")); - - EXPECT_EQ(0u, my_string.find("g")); - EXPECT_EQ(4u, my_string.find("g", 1)); - - EXPECT_EQ(0u, my_string.find("go")); - EXPECT_EQ(8u, my_string.find("go", 1)); - - EXPECT_EQ(1u, my_string.find("oo")); - EXPECT_EQ(1u, my_string.find("oo", 1)); - EXPECT_EQ(2u, my_string.find("oo", 2)); - EXPECT_EQ(9u, my_string.find("oo", 3)); - - EXPECT_EQ(4u, my_string.find("gle")); - EXPECT_EQ(12u, my_string.find("gle", 5)); - - EXPECT_EQ(npos, my_string.find("0")); - EXPECT_EQ(npos, my_string.find("does-not-exist")); - EXPECT_EQ(npos, my_string.find("longer than gooogle gooogle")); - - EXPECT_EQ(npos, my_string.find("", npos)); - EXPECT_EQ(npos, my_string.find("gle", npos)); -} - -TEST(string_piece, get_fields) { - string_piece input; - std::vector expected_lines; - EXPECT_EQ(expected_lines, input.get_fields('\n')); - EXPECT_EQ(expected_lines, input.get_fields('\n', true)); - - input = "first line"; - expected_lines = {"first line"}; - EXPECT_EQ(expected_lines, input.get_fields('\n')); - EXPECT_EQ(expected_lines, input.get_fields('\n', true)); - - input = "first line\n"; - expected_lines = {"first line"}; - EXPECT_EQ(expected_lines, input.get_fields('\n')); - expected_lines = {"first line\n"}; - EXPECT_EQ(expected_lines, input.get_fields('\n', true)); - - input = "\nfirst line"; - expected_lines = {"", "first line"}; - EXPECT_EQ(expected_lines, input.get_fields('\n')); - expected_lines = {"\n", "first line"}; - EXPECT_EQ(expected_lines, input.get_fields('\n', true)); - - input = "first line\nsecond line\nthird line\n"; - expected_lines = {"first line", "second line", "third line"}; - EXPECT_EQ(expected_lines, input.get_fields('\n')); - expected_lines = {"first line\n", "second line\n", "third line\n"}; - EXPECT_EQ(expected_lines, input.get_fields('\n', true)); - - input = "first line\n\nsecond line\n\nthird line\n\n"; - expected_lines = {"first line", "", "second line", "", "third line", ""}; - EXPECT_EQ(expected_lines, input.get_fields('\n')); - expected_lines = {"first line\n", "\n", "second line\n", - "\n", "third line\n", "\n"}; - EXPECT_EQ(expected_lines, input.get_fields('\n', true)); -} - -TEST(string_piece, operator_stream_out) { - std::stringstream stream; - string_piece my_string("my really long string"); - stream << my_string; - EXPECT_EQ("my really long string", stream.str()); - stream.str(""); - stream << my_string.substr(3, 6); - EXPECT_EQ("really", stream.str()); - stream.str(""); - stream << string_piece(); - EXPECT_EQ("", stream.str()); -} - -TEST(string_piece, lrstrip) { - string_piece nothing_to_remove("abcdefg"); - EXPECT_EQ("abcdefg", nothing_to_remove.lstrip("hijklmn")); - EXPECT_EQ("abcdefg", nothing_to_remove.rstrip("hijklmn")); - EXPECT_EQ("abcdefg", nothing_to_remove.strip("hijklmn")); - - string_piece empty_string(""); - EXPECT_EQ(0u, empty_string.lstrip("google").size()); - EXPECT_EQ(0u, empty_string.rstrip("google").size()); - EXPECT_EQ(0u, empty_string.strip("google").size()); - - string_piece remove_nothing("asdfghjkl"); - EXPECT_EQ("asdfghjkl", remove_nothing.lstrip("")); - EXPECT_EQ("asdfghjkl", remove_nothing.rstrip("")); - EXPECT_EQ("asdfghjkl", remove_nothing.strip("")); - - string_piece strip_numbers("0123g4o5o6g7l8e9"); - EXPECT_EQ("g4o5o6g7l8e9", strip_numbers.lstrip("0123456789")); - EXPECT_EQ("0123g4o5o6g7l8e", strip_numbers.rstrip("0123456789")); - EXPECT_EQ("g4o5o6g7l8e", strip_numbers.strip("0123456789")); -} - -TEST(string_piece, strip_whitespace) { - string_piece lots_of_space(" b i n g o "); - EXPECT_EQ("b i n g o", lots_of_space.strip_whitespace()); - - string_piece whitespaces("\v\t\f\n\rleft\r\t\f\n\vright\f\n\t\v\r"); - EXPECT_EQ("left\r\t\f\n\vright", whitespaces.strip_whitespace()); - - string_piece remove_all(" \t "); - EXPECT_EQ(0u, remove_all.strip_whitespace().size()); -} - -TEST(string_piece, not_equal) { - EXPECT_FALSE(string_piece() != string_piece()); - EXPECT_FALSE(string_piece("") != string_piece()); - EXPECT_TRUE(string_piece() != string_piece(" ")); - EXPECT_FALSE(string_piece("abc") != string_piece("abc")); - EXPECT_TRUE(string_piece("abc") != string_piece("abc ")); - EXPECT_TRUE(string_piece("abc") != string_piece("abd")); - - EXPECT_FALSE("" != string_piece()); - EXPECT_FALSE("" != string_piece("")); - EXPECT_TRUE(" " != string_piece("")); - EXPECT_FALSE("abc" != string_piece("abc")); - EXPECT_TRUE(" abc" != string_piece("abc")); - EXPECT_TRUE("abd" != string_piece("abc")); -} - -TEST(string_piece, data) { - EXPECT_EQ(nullptr, string_piece().data()); - const char* empty = ""; - EXPECT_EQ(empty, string_piece(empty).data()); - const char* space = " "; - EXPECT_EQ(space, string_piece(space).data()); - const char* a = "a"; - EXPECT_EQ(a, string_piece(a).data()); - const char* abc = "abc"; - EXPECT_EQ(abc, string_piece(abc).data()); - EXPECT_EQ(abc + 1, string_piece(abc).substr(1).data()); - EXPECT_EQ(abc + 3, string_piece(abc).substr(3).data()); -} - -TEST(string_piece, unordered_map) { - std::unordered_map dict; - dict["abc"] = 123; - EXPECT_EQ(123, dict["abc"]); -} - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/src/version_profile.cc b/lib/shaderc/libshaderc_util/src/version_profile.cc deleted file mode 100644 index cefbb3b84..000000000 --- a/lib/shaderc/libshaderc_util/src/version_profile.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/version_profile.h" - -#include -#include - -namespace { - -const int kVersionNumberLength = 3; -const int kMaxProfileLength = 13; // strlen(compatibility) -const int kMaxVersionProfileLength = kVersionNumberLength + kMaxProfileLength; -const int kMinVersionProfileLength = kVersionNumberLength; - -} // anonymous namespace - -namespace shaderc_util { - -bool ParseVersionProfile(const std::string& version_profile, int* version, - EProfile* profile) { - if (version_profile.size() < kMinVersionProfileLength || - version_profile.size() > kMaxVersionProfileLength || - !::isdigit(version_profile.front())) - return false; - - std::string profile_string; - std::istringstream(version_profile) >> *version >> profile_string; - - if (!IsKnownVersion(*version)) { - return false; - } - if (profile_string.empty()) { - *profile = ENoProfile; - } else if (profile_string == "core") { - *profile = ECoreProfile; - } else if (profile_string == "es") { - *profile = EEsProfile; - } else if (profile_string == "compatibility") { - *profile = ECompatibilityProfile; - } else { - return false; - } - - return true; -} - -} // namespace shaderc_util diff --git a/lib/shaderc/libshaderc_util/src/version_profile_test.cc b/lib/shaderc/libshaderc_util/src/version_profile_test.cc deleted file mode 100644 index 9adb29421..000000000 --- a/lib/shaderc/libshaderc_util/src/version_profile_test.cc +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2017 The Shaderc Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "libshaderc_util/version_profile.h" - -#include "gmock/gmock.h" - -namespace { - -using shaderc_util::IsKnownVersion; -using shaderc_util::ParseVersionProfile; -using ::testing::Eq; -using ::testing::ValuesIn; - - -TEST(IsKnownVersionTest, Samples) { - EXPECT_TRUE(IsKnownVersion(100)); - EXPECT_TRUE(IsKnownVersion(110)); - EXPECT_TRUE(IsKnownVersion(120)); - EXPECT_TRUE(IsKnownVersion(130)); - EXPECT_TRUE(IsKnownVersion(140)); - EXPECT_TRUE(IsKnownVersion(150)); - EXPECT_TRUE(IsKnownVersion(300)); - EXPECT_TRUE(IsKnownVersion(330)); - EXPECT_TRUE(IsKnownVersion(310)); - EXPECT_TRUE(IsKnownVersion(400)); - EXPECT_TRUE(IsKnownVersion(410)); - EXPECT_TRUE(IsKnownVersion(420)); - EXPECT_TRUE(IsKnownVersion(430)); - EXPECT_TRUE(IsKnownVersion(440)); - EXPECT_TRUE(IsKnownVersion(450)); - EXPECT_TRUE(IsKnownVersion(460)); - EXPECT_FALSE(IsKnownVersion(101)); - EXPECT_FALSE(IsKnownVersion(470)); -} - - -struct ParseVersionProfileCase { - std::string input; - bool success; - // The following are only used when success is true. - int expected_version; - EProfile expected_profile; -}; - -using ParseVersionProfileTest = ::testing::TestWithParam; - -TEST_P(ParseVersionProfileTest, Sample) { - int version = 0; - EProfile profile = EBadProfile; - const bool result = ParseVersionProfile(GetParam().input, &version, &profile); - EXPECT_THAT(result, GetParam().success); - if (result) { - EXPECT_THAT(version, GetParam().expected_version); - EXPECT_THAT(profile, GetParam().expected_profile); - } -} - - -// For OpenGL ES GLSL (ESSL) versions, see -// https://www.khronos.org/registry/OpenGL/index_e.php - -INSTANTIATE_TEST_SUITE_P(OpenGLESCases, ParseVersionProfileTest, - ValuesIn(std::vector{ - {"100es", true, 100, EEsProfile}, - {"300es", true, 300, EEsProfile}, - {"310es", true, 310, EEsProfile}, - {"320es", true, 320, EEsProfile}, - {"99es", false, 0, EBadProfile}, - {"500es", false, 0, EBadProfile}, - })); - -// For OpenGL GLSL versions, see -// https://www.khronos.org/registry/OpenGL/index_gl.php - -INSTANTIATE_TEST_SUITE_P(OpenGLBlankCases, ParseVersionProfileTest, - ValuesIn(std::vector{ - {"110", true, 110, ENoProfile}, - {"120", true, 120, ENoProfile}, - {"130", true, 130, ENoProfile}, - {"140", true, 140, ENoProfile}, - {"150", true, 150, ENoProfile}, - {"330", true, 330, ENoProfile}, - {"400", true, 400, ENoProfile}, - {"410", true, 410, ENoProfile}, - {"420", true, 420, ENoProfile}, - {"430", true, 430, ENoProfile}, - {"440", true, 440, ENoProfile}, - {"450", true, 450, ENoProfile}, - {"460", true, 460, ENoProfile}, - {"99", false, 0, EBadProfile}, - {"500", false, 0, EBadProfile}, - })); - -INSTANTIATE_TEST_SUITE_P(OpenGLCoreCases, ParseVersionProfileTest, - ValuesIn(std::vector{ - {"320core", true, 320, ECoreProfile}, - {"330core", true, 330, ECoreProfile}, - {"400core", true, 400, ECoreProfile}, - {"410core", true, 410, ECoreProfile}, - {"420core", true, 420, ECoreProfile}, - {"430core", true, 430, ECoreProfile}, - {"440core", true, 440, ECoreProfile}, - {"450core", true, 450, ECoreProfile}, - {"460core", true, 460, ECoreProfile}, - })); - -INSTANTIATE_TEST_SUITE_P( - OpenGLCompatibilityCases, ParseVersionProfileTest, - ValuesIn(std::vector{ - {"320compatibility", true, 320, ECompatibilityProfile}, - {"330compatibility", true, 330, ECompatibilityProfile}, - {"400compatibility", true, 400, ECompatibilityProfile}, - {"410compatibility", true, 410, ECompatibilityProfile}, - {"420compatibility", true, 420, ECompatibilityProfile}, - {"430compatibility", true, 430, ECompatibilityProfile}, - {"440compatibility", true, 440, ECompatibilityProfile}, - {"450compatibility", true, 450, ECompatibilityProfile}, - {"460compatibility", true, 460, ECompatibilityProfile}, - })); - -} // anonymous namespace diff --git a/lib/shaderc/libshaderc_util/testdata/copy-to-build.cmake b/lib/shaderc/libshaderc_util/testdata/copy-to-build.cmake deleted file mode 100644 index 7b41b61e7..000000000 --- a/lib/shaderc/libshaderc_util/testdata/copy-to-build.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2020 The Shaderc Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -file(GLOB all_files ${CMAKE_CURRENT_LIST_DIR}/*) -file(COPY ${all_files} DESTINATION .) \ No newline at end of file diff --git a/lib/shaderc/libshaderc_util/testdata/dir/subdir/include_file.2 b/lib/shaderc/libshaderc_util/testdata/dir/subdir/include_file.2 deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/shaderc/libshaderc_util/testdata/include_file.1 b/lib/shaderc/libshaderc_util/testdata/include_file.1 deleted file mode 100644 index 8af65f2e8..000000000 --- a/lib/shaderc/libshaderc_util/testdata/include_file.1 +++ /dev/null @@ -1 +0,0 @@ -The quick brown fox jumps over a lazy dog. \ No newline at end of file diff --git a/lib/shaderc/license-checker.cfg b/lib/shaderc/license-checker.cfg deleted file mode 100644 index 7afc70daf..000000000 --- a/lib/shaderc/license-checker.cfg +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "licenses": [ "Apache-2.0" ], - "paths": [ - { - "exclude": [ - "**.md", - "**.png", - "**/README.asciidoc", - - ".*", - "AUTHORS", - "CHANGES", - "CONTRIBUTORS", - "DEPS", - "LICENSE", - - "cmake/*.pc.in", - "libshaderc_util/testdata/dir/subdir/include_file.2", - "libshaderc_util/testdata/include_file.1", - - "utils/git-sync-deps", - - "third_party/**" - ] - } - ] - }, - { - "licenses": [ "BSD-3-Clause" ], - "paths": [ - { "exclude": [ "**" ] }, - { "include": [ "utils/git-sync-deps" ] } - ] - } -] diff --git a/lib/shaderc/third_party/Android.mk b/lib/shaderc/third_party/Android.mk deleted file mode 100644 index 16ea3a19f..000000000 --- a/lib/shaderc/third_party/Android.mk +++ /dev/null @@ -1,35 +0,0 @@ -THIRD_PARTY_PATH := $(call my-dir) - -# Set the location of glslang -ifeq ($(GLSLANG_LOCAL_PATH),) - GLSLANG_LOCAL_PATH:=$(THIRD_PARTY_PATH)/glslang -endif -include $(GLSLANG_LOCAL_PATH)/Android.mk - -# Set the location of SPIRV-Tools. -# Allow the user to override it, but default it to under our third_party directory. -ifeq ($(SPVTOOLS_LOCAL_PATH),) - SPVTOOLS_LOCAL_PATH:=$(THIRD_PARTY_PATH)/spirv-tools -endif -ifeq ($(SPVHEADERS_LOCAL_PATH),) - # Use the third party dir if it exists. - ifneq ($(wildcard $(THIRD_PARTY_PATH)/spirv-headers/include/spirv/spir-v.xml),) - SPVHEADERS_LOCAL_PATH:=$(THIRD_PARTY_PATH)/spirv-headers - else - # Let SPIRV-Tools find its own headers and hope for the best. - endif -endif - -# Now include the SPIRV-Tools dependency -include $(SPVTOOLS_LOCAL_PATH)/Android.mk - -ifeq ($(SHADERC_ENABLE_SPVC),1) - # Set the location of SPIRV-Cross. - # Allow the user to override it, but default it to under our third_party directory. - ifeq ($(SPVCROSS_LOCAL_PATH),) - SPVCROSS_LOCAL_PATH:=$(THIRD_PARTY_PATH)/spirv-cross - endif - - # Now include the SPIRV-Cross dependency - include $(SPVCROSS_LOCAL_PATH)/jni/Android.mk -endif diff --git a/lib/shaderc/third_party/CMakeLists.txt b/lib/shaderc/third_party/CMakeLists.txt deleted file mode 100644 index 7bd9617e3..000000000 --- a/lib/shaderc/third_party/CMakeLists.txt +++ /dev/null @@ -1,100 +0,0 @@ -# Suppress all warnings from third-party projects. -set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -w) - -set(SHADERC_THIRD_PARTY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING - "Root location of all third_party projects") -set(SHADERC_GOOGLE_TEST_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/googletest" CACHE STRING - "Location of googletest source") -set(SHADERC_SPIRV_TOOLS_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/spirv-tools" CACHE STRING - "Location of spirv-tools source") -set(SHADERC_SPIRV_HEADERS_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/spirv-headers" CACHE STRING - "Location of spirv-headers source") -set(SHADERC_GLSLANG_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/glslang" CACHE STRING - "Location of glslang source") -set(SHADERC_EFFCEE_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/effcee" CACHE STRING - "Location of effcee source") -set(SHADERC_RE2_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/re2" CACHE STRING - "Location of re2 source") -set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING - "Location of tint source") - -set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} ) -set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} ) -set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} ) - -# Configure third party projects. -if(${SHADERC_ENABLE_TESTS}) - if (IS_DIRECTORY ${SHADERC_GOOGLE_TEST_DIR}) - add_subdirectory(${SHADERC_GOOGLE_TEST_DIR} googletest) - endif() - if (NOT TARGET gmock) - message(FATAL_ERROR "gmock was not found - required for tests") - endif() -endif() - -set(OLD_PLATFORM_TOOLSET ${CMAKE_GENERATOR_TOOLSET}) -check_cxx_compiler_flag(-fPIC COMPILER_SUPPORTS_PIC) - - -if (IS_DIRECTORY ${SHADERC_SPIRV_HEADERS_DIR}) - set(SPIRV_HEADERS_SKIP_EXAMPLES ON) - add_subdirectory(${SHADERC_SPIRV_HEADERS_DIR} spirv-headers) -endif() - -if (NOT TARGET SPIRV-Tools) - # Check SPIRV-Tools before glslang so that it is linked into glslang. - # we control optimizations via glslang API calls directly. - if (IS_DIRECTORY ${SHADERC_SPIRV_TOOLS_DIR}) - if ("${SHADERC_SKIP_TESTS}") - # Also skip building tests in SPIRV-Tools. - set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests") - elseif(NOT "${SPIRV_SKIP_TESTS}") - # SPIRV-Tools requires effcee and re2 to build tests. - # re2 tests take a long time and do not add much value, since re2 is a - # dependency of a dependency, so not running them. - set(RE2_BUILD_TESTING OFF CACHE STRING "Run RE2 Tests") - add_subdirectory(${SHADERC_RE2_DIR} re2) - add_subdirectory(${SHADERC_EFFCEE_DIR} effcee) - endif() - add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools) - endif() - if (NOT TARGET SPIRV-Tools) - message(FATAL_ERROR "SPIRV-Tools was not found - required for compilation") - endif() -endif() - -if (NOT TARGET glslang) - if (IS_DIRECTORY ${SHADERC_GLSLANG_DIR}) - add_subdirectory(${SHADERC_GLSLANG_DIR} glslang) - endif() - if (NOT TARGET glslang) - message(FATAL_ERROR "glslang was not found - required for compilation") - endif() - if(WIN32) - # This is unfortunate but glslang forces our - # platform toolset to be v110, which we may not even have - # installed, undo anything glslang has done to it. - set(CMAKE_GENERATOR_TOOLSET "${OLD_PLATFORM_TOOLSET}" CACHE STRING - "Platform Toolset" FORCE) - endif() -endif() - -if (SHADERC_ENABLE_WGSL_OUTPUT) - # Use Google Tint for WGSL output. - if (NOT TARGET libtint) - if (IS_DIRECTORY ${SHADERC_TINT_DIR}) - if (NOT IS_DIRECTORY ${SHADERC_TINT_DIR}/out/docs) - # The Tint Doxygen configuration assumes it can write to the out/docs - # source directory. - message(STATUS "Tint source directory out/docs does not exist. Disabling doc generation") - set(TINT_BUILD_DOCS OFF) - endif() - set(TINT_BUILD_SPV_READER ON CACHE BOOL "Built Tint SPIR-V reader" FORCE) - set(TINT_BUILD_WGSL_WRITER ON CACHE BOOL "Build Tint WGSL writer" FORCE) - add_subdirectory(${SHADERC_TINT_DIR} tint) - endif() - endif() - if (NOT TARGET libtint) - message(FATAL_ERROR "Tint was not found - required for WGSL output") - endif() -endif (SHADERC_ENABLE_WGSL_OUTPUT) diff --git a/lib/shaderc/third_party/LICENSE.glslang b/lib/shaderc/third_party/LICENSE.glslang deleted file mode 100644 index 7075f338b..000000000 --- a/lib/shaderc/third_party/LICENSE.glslang +++ /dev/null @@ -1,172 +0,0 @@ ------ -Most code has one of the following copyrights: - - Copyright (C) 2002-2005 3Dlabs Inc. Ltd. - Copyright (C) 2012-2014 LunarG, Inc. - Copyright (C) 2002-2010 The ANGLE Project Authors. - Copyright (C) 2015-2016 Google, Inc. - -and is covered under the following license (BSD): - -// -//All rights reserved. -// -//Redistribution and use in source and binary forms, with or without -//modification, are permitted provided that the following conditionsA -//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 3Dlabs Inc. Ltd. 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. -// - - ------ -Files under glslang/MachineIndependent/preprocessor used under -the following license (BSD-like): - -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - - ------ -The file glslang/MachineIndependent/gl_types.h has the following -license (MIT): - -/* -** Copyright (c) 2013 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ - ------ -The files glslang/SPIRV/GLSL.std.450.h and - glslang/SPIRV/spirv.hpp have the following license. -/* -** Copyright (c) 2014-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - ------ -Files under tools/data contain portions of GNU Bison, and are used under -the following license (GPL v3), with an exception as described at -at http://www.gnu.org/software/bison/manual/bison.html#Conditions. -In particular, when parsers are generated from the template files, an -exception clause is inserted into the generated source files which allows -their use in non-free programs. - -# Copyright (C) 1984, 1989-1990, 1999-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - diff --git a/lib/shaderc/third_party/LICENSE.spirv-tools b/lib/shaderc/third_party/LICENSE.spirv-tools deleted file mode 100644 index 12204d241..000000000 --- a/lib/shaderc/third_party/LICENSE.spirv-tools +++ /dev/null @@ -1,211 +0,0 @@ -Note: The license for SPIRV-Tools changed to Apache 2.0 via this commit: -https://github.com/KhronosGroup/SPIRV-Tools/commit/9fc8658ef301b0f03b2173d274c52f011b5c73e5 - - -// Copyright (c) 2015-2016 The Khronos Group Inc. -// Copyright (c) 2015-2016 Google Inc. -// Copyright (c) 2016 LunarG Inc. - - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/lib/shaderc/third_party/glslang/.appveyor.yml b/lib/shaderc/third_party/glslang/.appveyor.yml deleted file mode 100644 index bf8c57260..000000000 --- a/lib/shaderc/third_party/glslang/.appveyor.yml +++ /dev/null @@ -1,108 +0,0 @@ -# Windows Build Configuration for AppVeyor -# http://www.appveyor.com/docs/appveyor-yml - -# build version format -version: "{build}" - -os: Visual Studio 2015 - -platform: - - x64 - -configuration: - - Debug - - Release - -branches: - only: - - master - -# changes to these files don't need to trigger testing -skip_commits: - files: - - README.md - - README-spirv-remap.txt - - LICENSE.txt - - CODE_OF_CONDUCT.md - - BUILD.* - - WORKSPACE - - kokoro/* - - make-revision - - Android.mk - - _config.yml - -# Travis advances the master-tot tag to current top of the tree after -# each push into the master branch, because it relies on that tag to -# upload build artifacts to the master-tot release. This will cause -# double testing for each push on Appveyor: one for the push, one for -# the tag advance. Disable testing tags. -skip_tags: true - -clone_depth: 5 - -matrix: - fast_finish: true # Show final status immediately if a test fails. - -# scripts that run after cloning repository -install: - - C:/Python27/python.exe update_glslang_sources.py - - set PATH=C:\ninja;C:\Python36;%PATH% - - git clone https://github.com/google/googletest.git External/googletest - -build: - parallel: true # enable MSBuild parallel builds - verbosity: minimal - -build_script: - - mkdir build && cd build - - cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=install .. - - cmake --build . --config %CONFIGURATION% --target install - -test_script: - - ctest -C %CONFIGURATION% --output-on-failure - - cd ../Test && bash runtests - - cd ../build - -after_test: - # For debug build, the generated dll has a postfix "d" in its name. - - ps: >- - If ($env:configuration -Match "Debug") { - $env:SUFFIX="d" - } Else { - $env:SUFFIX="" - } - - cd install - # Zip all glslang artifacts for uploading and deploying - - 7z a glslang-master-windows-"%PLATFORM%"-"%CONFIGURATION%".zip - bin\glslangValidator.exe - bin\spirv-remap.exe - include\glslang\* - lib\GenericCodeGen%SUFFIX%.lib - lib\glslang%SUFFIX%.lib - lib\glslang-default-resource-limits%SUFFIX%.lib - lib\HLSL%SUFFIX%.lib - lib\MachineIndependent%SUFFIX%.lib - lib\OGLCompiler%SUFFIX%.lib - lib\OSDependent%SUFFIX%.lib - lib\SPIRV%SUFFIX%.lib - lib\SPVRemapper%SUFFIX%.lib - lib\SPIRV-Tools%SUFFIX%.lib - lib\SPIRV-Tools-opt%SUFFIX%.lib - -artifacts: - - path: build\install\*.zip - name: artifacts-zip - -deploy: - - provider: GitHub - auth_token: - secure: YglcSYdl0TylEa59H4K6lylBEDr586NAt2EMgZquSo+iuPrwgZQuJLPCoihSm9y6 - release: master-tot - description: "Continuous build of the latest master branch by Appveyor and Travis CI" - artifact: artifacts-zip - draft: false - prerelease: false - force_update: true - on: - branch: master - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 diff --git a/lib/shaderc/third_party/glslang/.clang-format b/lib/shaderc/third_party/glslang/.clang-format deleted file mode 100644 index 8c73a52fe..000000000 --- a/lib/shaderc/third_party/glslang/.clang-format +++ /dev/null @@ -1,13 +0,0 @@ -Language: Cpp -IndentWidth: 4 -PointerAlignment: Left -BreakBeforeBraces: Custom -BraceWrapping: { AfterFunction: true, AfterControlStatement: false } -IndentCaseLabels: false -ReflowComments: false -ColumnLimit: 120 -AccessModifierOffset: -4 -AlignTrailingComments: true -AllowShortBlocksOnASingleLine: false -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false diff --git a/lib/shaderc/third_party/glslang/.gitattributes b/lib/shaderc/third_party/glslang/.gitattributes deleted file mode 100644 index 2929e8358..000000000 --- a/lib/shaderc/third_party/glslang/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# test files have a mix of lf/crlf, and that's a good thing, for testing, don't mess with it -# bash scripts need lines ending with lf, and that's correct for Windows too, e.g., under Cygwin -# (scripts often don't have a suffix) -* -text -*.sh text eof=lf - -# txt files should be native and normalized -*.txt text - -# source code can be native and normalized, but simpler if lf everywhere; will try that way -*.h text eol=lf -*.c text eol=lf -*.cpp text eol=lf -*.y text eol=lf -*.out text eol=lf -*.conf text eol=lf -*.err text eol=lf diff --git a/lib/shaderc/third_party/glslang/.github/workflows/continuous_deployment.yml b/lib/shaderc/third_party/glslang/.github/workflows/continuous_deployment.yml deleted file mode 100644 index 86f439db8..000000000 --- a/lib/shaderc/third_party/glslang/.github/workflows/continuous_deployment.yml +++ /dev/null @@ -1,168 +0,0 @@ -# NOTE: This workflow was ported from Travis. -# Travis was using Ubuntu 14.04. Ubuntu 14.04 is not supportted by GitHub workflows. Ubuntu 20.04 is recommended. -# Travis was using Clang 3.6. The earliest version support by Ubuntu 20.04 is Clang 6.0. -# Travis was caching the clang package. APT package caching is not natively supported by GitHub actions/cache. -# Travis was using Mac OS X 10.13.6 / Xcode 9.4.1 / LLVM 9.1.0 - -# NOTE: The following documentation may be useful to maintainers of this workflow. -# Github actions: https://docs.github.com/en/actions -# Github github-script action: https://github.com/actions/github-script -# GitHub REST API: https://docs.github.com/en/rest -# Octokit front-end to the GitHub REST API: https://octokit.github.io/rest.js/v18 -# Octokit endpoint methods: https://github.com/octokit/plugin-rest-endpoint-methods.js/tree/master/docs/repos - -# TODO: Use actions/upload-artifact and actions/download-artifact to simplify deployment. -# TODO: Use composite actions to refactor redundant code. - -name: Continuous Deployment - -on: - workflow_dispatch: - push: - branches: - - master - -jobs: - linux: - runs-on: ${{matrix.os.genus}} - strategy: - fail-fast: false - matrix: - os: [{genus: ubuntu-20.04, family: linux}] - compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}] - cmake_build_type: [Debug, Release] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.7' - - name: Install Ubuntu Package Dependencies - run: | - sudo apt-get -qq update - sudo apt-get install -y clang-6.0 - - name: Install GoogleTest - run: | - # check out pre-breakage version of googletest; can be deleted when - # issue 3128 is fixed - # git clone --depth=1 https://github.com/google/googletest.git External/googletest - mkdir -p External/googletest - cd External/googletest - git init - git remote add origin https://github.com/google/googletest.git - git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725 - git reset --hard FETCH_HEAD - cd ../.. - - name: Update Glslang Sources - run: | - ./update_glslang_sources.py - - name: Build - env: - CC: ${{matrix.compiler.cc}} - CXX: ${{matrix.compiler.cxx}} - run: | - mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. - make -j4 install - - name: Test - run: | - cd build - ctest --output-on-failure && - cd ../Test && ./runtests - - name: Zip - if: ${{ matrix.compiler.cc == 'clang' }} - env: - ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip - run: | - cd build/install - zip ${ARCHIVE} \ - bin/glslangValidator \ - include/glslang/* \ - lib/libGenericCodeGen${SUFFIX}.a \ - lib/libglslang${SUFFIX}.a \ - lib/libglslang-default-resource-limits${SUFFIX}.a \ - lib/libHLSL${SUFFIX}.a \ - lib/libMachineIndependent${SUFFIX}.a \ - lib/libOGLCompiler${SUFFIX}.a \ - lib/libOSDependent${SUFFIX}.a \ - lib/libSPIRV${SUFFIX}.a \ - lib/libSPVRemapper${SUFFIX}.a \ - lib/libSPIRV-Tools${SUFFIX}.a \ - lib/libSPIRV-Tools-opt${SUFFIX}.a - - name: Deploy - if: ${{ matrix.compiler.cc == 'clang' }} - env: - ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip - uses: actions/github-script@v5 - with: - script: | - const script = require('.github/workflows/deploy.js') - await script({github, context, core}) - - macos: - runs-on: ${{matrix.os.genus}} - strategy: - fail-fast: false - matrix: - os: [{genus: macos-10.15, family: osx}] - compiler: [{cc: clang, cxx: clang++}] - cmake_build_type: [Debug, Release] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.7' - - name: Install GoogleTest - run: | - # check out pre-breakage version of googletest; can be deleted when - # issue 3128 is fixed - # git clone --depth=1 https://github.com/google/googletest.git External/googletest - mkdir -p External/googletest - cd External/googletest - git init - git remote add origin https://github.com/google/googletest.git - git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725 - git reset --hard FETCH_HEAD - cd ../.. - - name: Update Glslang Sources - run: | - ./update_glslang_sources.py - - name: Build - env: - CC: ${{matrix.compiler.cc}} - CXX: ${{matrix.compiler.cxx}} - run: | - mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. - make -j4 install - - name: Test - run: | - cd build - ctest --output-on-failure && - cd ../Test && ./runtests - - name: Zip - env: - ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip - run: | - cd build/install - zip ${ARCHIVE} \ - bin/glslangValidator \ - include/glslang/* \ - lib/libGenericCodeGen${SUFFIX}.a \ - lib/libglslang${SUFFIX}.a \ - lib/libglslang-default-resource-limits${SUFFIX}.a \ - lib/libHLSL${SUFFIX}.a \ - lib/libMachineIndependent${SUFFIX}.a \ - lib/libOGLCompiler${SUFFIX}.a \ - lib/libOSDependent${SUFFIX}.a \ - lib/libSPIRV${SUFFIX}.a \ - lib/libSPVRemapper${SUFFIX}.a \ - lib/libSPIRV-Tools${SUFFIX}.a \ - lib/libSPIRV-Tools-opt${SUFFIX}.a - - name: Deploy - env: - ARCHIVE: glslang-master-${{matrix.os.family}}-${{matrix.cmake_build_type}}.zip - uses: actions/github-script@v5 - with: - script: | - const script = require('.github/workflows/deploy.js') - await script({github, context, core}) diff --git a/lib/shaderc/third_party/glslang/.github/workflows/continuous_integration.yml b/lib/shaderc/third_party/glslang/.github/workflows/continuous_integration.yml deleted file mode 100644 index feec0dc22..000000000 --- a/lib/shaderc/third_party/glslang/.github/workflows/continuous_integration.yml +++ /dev/null @@ -1,157 +0,0 @@ -# NOTE: This workflow was ported from Travis. -# Travis was using Ubuntu 14.04. Ubuntu 14.04 is not supportted by GitHub workflows. Ubuntu 20.04 is recommended. -# Travis was using Clang 3.6. The earliest version support by Ubuntu 20.04 is Clang 6.0. -# Travis was caching the clang package. APT package caching is not natively supported by GitHub actions/cache. -# Travis was using Mac OS X 10.13.6 / Xcode 9.4.1 / LLVM 9.1.0 -# -name: Continuous Integration - -on: - workflow_dispatch: - pull_request: - branches: - - master - -jobs: - linux: - runs-on: ${{matrix.os}} - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04] - compiler: [{cc: clang, cxx: clang++}, {cc: gcc, cxx: g++}] - cmake_build_type: [Debug, Release] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.7' - - name: Install Ubuntu Package Dependencies - run: | - sudo apt-get -qq update - sudo apt-get install -y clang-6.0 - - name: Install GoogleTest - run: | - # check out pre-breakage version of googletest; can be deleted when - # issue 3128 is fixed - # git clone --depth=1 https://github.com/google/googletest.git External/googletest - mkdir -p External/googletest - cd External/googletest - git init - git remote add origin https://github.com/google/googletest.git - git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725 - git reset --hard FETCH_HEAD - cd ../.. - - name: Update Glslang Sources - run: | - ./update_glslang_sources.py - - name: Build - env: - CC: ${{matrix.compiler.cc}} - CXX: ${{matrix.compiler.cxx}} - run: | - mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. - make -j4 install - - name: Test - run: | - cd build - ctest --output-on-failure && - cd ../Test && ./runtests - - macos: - runs-on: ${{matrix.os}} - strategy: - fail-fast: false - matrix: - os: [macos-10.15] - compiler: [{cc: clang, cxx: clang++}] - cmake_build_type: [Debug, Release] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.7' - - name: Install GoogleTest - run: | - # check out pre-breakage version of googletest; can be deleted when - # issue 3128 is fixed - # git clone --depth=1 https://github.com/google/googletest.git External/googletest - mkdir -p External/googletest - cd External/googletest - git init - git remote add origin https://github.com/google/googletest.git - git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725 - git reset --hard FETCH_HEAD - cd ../.. - - name: Update Glslang Sources - run: | - ./update_glslang_sources.py - - name: Build - env: - CC: ${{matrix.compiler.cc}} - CXX: ${{matrix.compiler.cxx}} - run: | - mkdir build && cd build - cmake -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DCMAKE_INSTALL_PREFIX=`pwd`/install .. - make -j4 install - - name: Test - run: | - cd build - ctest --output-on-failure && - cd ../Test && ./runtests - - android: - runs-on: ${{matrix.os}} - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04] - compiler: [{cc: clang, cxx: clang++}] - cmake_build_type: [Release] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.7' - - name: Install Ubuntu Package Dependencies - if: ${{matrix.os == 'ubuntu-20.04'}} - run: | - sudo apt-get -qq update - sudo apt-get install -y clang-6.0 - - name: Install Android NDK - run: | - export ANDROID_NDK=$HOME/android-ndk - git init $ANDROID_NDK - pushd $ANDROID_NDK - git remote add dneto0 https://github.com/dneto0/android-ndk.git - git fetch --depth=1 dneto0 r17b-strip - git checkout FETCH_HEAD - popd - - name: Install GoogleTest - run: | - # check out pre-breakage version of googletest; can be deleted when - # issue 3128 is fixed - # git clone --depth=1 https://github.com/google/googletest.git External/googletest - mkdir -p External/googletest - cd External/googletest - git init - git remote add origin https://github.com/google/googletest.git - git fetch --depth 1 origin 0c400f67fcf305869c5fb113dd296eca266c9725 - git reset --hard FETCH_HEAD - cd ../.. - - name: Update Glslang Sources - run: | - ./update_glslang_sources.py - - name: Build - env: - CC: ${{matrix.compiler.cc}} - CXX: ${{matrix.compiler.cxx}} - run: | - export ANDROID_NDK=$HOME/android-ndk - export TOOLCHAIN_PATH=$ANDROID_NDK/build/cmake/android.toolchain.cmake - echo $ANDROID_NDK - echo $TOOLCHAIN_PATH - mkdir build && cd build - cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_PATH} -DANDROID_NATIVE_API_LEVEL=android-14 -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} -DANDROID_ABI="armeabi-v7a with NEON" -DBUILD_TESTING=OFF .. - make -j4 diff --git a/lib/shaderc/third_party/glslang/.github/workflows/deploy.js b/lib/shaderc/third_party/glslang/.github/workflows/deploy.js deleted file mode 100644 index 82ebb1bd9..000000000 --- a/lib/shaderc/third_party/glslang/.github/workflows/deploy.js +++ /dev/null @@ -1,73 +0,0 @@ -module.exports = async ({github, context, core}) => { - try { - await github.rest.git.updateRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'tags/master-tot', - sha: context.sha - }) - } catch (error) { - core.setFailed(`upload master-tot tag; ${error.name}; ${error.message}`) - } - - let release - try { - release = await github.rest.repos.getReleaseByTag({ - owner: context.repo.owner, - repo: context.repo.repo, - tag: 'master-tot' - }) - } catch (error) { - core.setFailed(`get the master release; ${error.name}; ${error.message}`) - } - - try { - await github.rest.repos.updateRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: release.data.id - }) - } catch (error) { - core.setFailed(`update the master release; ${error.name}; ${error.message}`) - } - - let release_assets - try { - release_assets = await github.rest.repos.listReleaseAssets({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: release.data.id - }) - } catch (error) { - core.setFailed(`list release assets; ${error.name}; ${error.message}`) - } - - const { ARCHIVE } = process.env - for (const release_asset of release_assets.data) { - if (release_asset.name === `${ ARCHIVE }`) { - try { - await github.rest.repos.deleteReleaseAsset({ - owner: context.repo.owner, - repo: context.repo.repo, - asset_id: release_asset.id - }) - } catch (error) { - core.setFailed(`delete ${ ARCHIVE }; ${error.name}; ${error.message}`) - } - } - } - - try { - const asset_path = `./build/install/${ ARCHIVE }` - const fs = require("fs") - await github.rest.repos.uploadReleaseAsset({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: release.data.id, - name: `${ ARCHIVE }`, - data: fs.readFileSync(asset_path) - }) - } catch (error) { - core.setFailed(`upload ${ ARCHIVE }; ${error.name}; ${error.message}`) - } -} diff --git a/lib/shaderc/third_party/glslang/.gn b/lib/shaderc/third_party/glslang/.gn deleted file mode 100644 index 5befb8019..000000000 --- a/lib/shaderc/third_party/glslang/.gn +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -buildconfig = "//build/config/BUILDCONFIG.gn" - -default_args = { - clang_use_chrome_plugins = false - use_custom_libcxx = false -} diff --git a/lib/shaderc/third_party/glslang/Android.mk b/lib/shaderc/third_party/glslang/Android.mk deleted file mode 100644 index c9b221f1a..000000000 --- a/lib/shaderc/third_party/glslang/Android.mk +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -LOCAL_PATH := $(call my-dir) - -# Generate glslang/build_info.h -GLSLANG_GENERATED_INCLUDEDIR:=$(TARGET_OUT)/include -GLSLANG_BUILD_INFO_H:=$(GLSLANG_GENERATED_INCLUDEDIR)/glslang/build_info.h - -define gen_glslang_build_info_h -$(call generate-file-dir,$(GLSLANG_GENERATED_INCLUDEDIR)/dummy_filename) -$(GLSLANG_BUILD_INFO_H): \ - $(LOCAL_PATH)/build_info.py \ - $(LOCAL_PATH)/build_info.h.tmpl \ - $(LOCAL_PATH)/CHANGES.md - @$(HOST_PYTHON) $(LOCAL_PATH)/build_info.py \ - $(LOCAL_PATH) \ - -i $(LOCAL_PATH)/build_info.h.tmpl \ - -o $(GLSLANG_BUILD_INFO_H) - @echo "[$(TARGET_ARCH_ABI)] Generate : $(GLSLANG_BUILD_INFO_H) <= CHANGES.md" -endef -$(eval $(call gen_glslang_build_info_h)) - -GLSLANG_OS_FLAGS := -DGLSLANG_OSINCLUDE_UNIX -# AMD and NV extensions are turned on by default in upstream Glslang. -GLSLANG_DEFINES:= -DAMD_EXTENSIONS -DNV_EXTENSIONS -DENABLE_HLSL $(GLSLANG_OS_FLAGS) - -include $(CLEAR_VARS) -LOCAL_MODULE:=OSDependent -LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES) -LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH) -LOCAL_SRC_FILES:=glslang/OSDependent/Unix/ossource.cpp -LOCAL_C_INCLUDES:=$(LOCAL_PATH) $(LOCAL_PATH)/glslang/OSDependent/Unix/ -LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/OSDependent/Unix/ -include $(BUILD_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_MODULE:=OGLCompiler -LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES) -LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH) -LOCAL_SRC_FILES:=OGLCompilersDLL/InitializeDll.cpp -LOCAL_C_INCLUDES:=$(LOCAL_PATH)/OGLCompiler -LOCAL_STATIC_LIBRARIES:=OSDependent -include $(BUILD_STATIC_LIBRARY) - -# Build the stubbed HLSL library. -# The HLSL source is now directly referenced by the glslang static library -# instead. -include $(CLEAR_VARS) -LOCAL_MODULE:=HLSL -LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES) -LOCAL_SRC_FILES:= \ - hlsl/stub.cpp -LOCAL_C_INCLUDES:=$(LOCAL_PATH) \ - $(LOCAL_PATH)/glslang/HLSL -include $(BUILD_STATIC_LIBRARY) - -include $(CLEAR_VARS) -GLSLANG_OUT_PATH=$(if $(call host-path-is-absolute,$(TARGET_OUT)),$(TARGET_OUT),$(abspath $(TARGET_OUT))) - -# ShaderLang.cpp depends on the generated build_info.h -$(LOCAL_PATH)/glslang/MachineIndependent/ShaderLang.cpp: \ - $(GLSLANG_BUILD_INFO_H) - -LOCAL_MODULE:=glslang -LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti $(GLSLANG_DEFINES) -LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH) -LOCAL_SRC_FILES:= \ - glslang/GenericCodeGen/CodeGen.cpp \ - glslang/GenericCodeGen/Link.cpp \ - glslang/HLSL/hlslAttributes.cpp \ - glslang/HLSL/hlslGrammar.cpp \ - glslang/HLSL/hlslOpMap.cpp \ - glslang/HLSL/hlslParseables.cpp \ - glslang/HLSL/hlslParseHelper.cpp \ - glslang/HLSL/hlslScanContext.cpp \ - glslang/HLSL/hlslTokenStream.cpp \ - glslang/MachineIndependent/attribute.cpp \ - glslang/MachineIndependent/Constant.cpp \ - glslang/MachineIndependent/glslang_tab.cpp \ - glslang/MachineIndependent/InfoSink.cpp \ - glslang/MachineIndependent/Initialize.cpp \ - glslang/MachineIndependent/Intermediate.cpp \ - glslang/MachineIndependent/intermOut.cpp \ - glslang/MachineIndependent/IntermTraverse.cpp \ - glslang/MachineIndependent/iomapper.cpp \ - glslang/MachineIndependent/limits.cpp \ - glslang/MachineIndependent/linkValidate.cpp \ - glslang/MachineIndependent/parseConst.cpp \ - glslang/MachineIndependent/ParseContextBase.cpp \ - glslang/MachineIndependent/ParseHelper.cpp \ - glslang/MachineIndependent/PoolAlloc.cpp \ - glslang/MachineIndependent/propagateNoContraction.cpp \ - glslang/MachineIndependent/reflection.cpp \ - glslang/MachineIndependent/RemoveTree.cpp \ - glslang/MachineIndependent/Scan.cpp \ - glslang/MachineIndependent/ShaderLang.cpp \ - glslang/MachineIndependent/SpirvIntrinsics.cpp \ - glslang/MachineIndependent/SymbolTable.cpp \ - glslang/MachineIndependent/Versions.cpp \ - glslang/MachineIndependent/preprocessor/PpAtom.cpp \ - glslang/MachineIndependent/preprocessor/PpContext.cpp \ - glslang/MachineIndependent/preprocessor/Pp.cpp \ - glslang/MachineIndependent/preprocessor/PpScanner.cpp \ - glslang/MachineIndependent/preprocessor/PpTokens.cpp -LOCAL_C_INCLUDES:=$(LOCAL_PATH) \ - $(LOCAL_PATH)/glslang/MachineIndependent \ - $(GLSLANG_GENERATED_INCLUDEDIR) \ - $(GLSLANG_OUT_PATH) -LOCAL_STATIC_LIBRARIES:=OSDependent OGLCompiler HLSL -include $(BUILD_STATIC_LIBRARY) - -include $(CLEAR_VARS) - -# GlslangToSpv.cpp depends on the generated build_info.h -$(LOCAL_PATH)/SPIRV/GlslangToSpv.cpp: \ - $(GLSLANG_BUILD_INFO_H) - -LOCAL_MODULE:=SPIRV -LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -Werror $(GLSLANG_DEFINES) -LOCAL_SRC_FILES:= \ - SPIRV/GlslangToSpv.cpp \ - SPIRV/InReadableOrder.cpp \ - SPIRV/Logger.cpp \ - SPIRV/SPVRemapper.cpp \ - SPIRV/SpvBuilder.cpp \ - SPIRV/SpvPostProcess.cpp \ - SPIRV/SpvTools.cpp \ - SPIRV/disassemble.cpp \ - SPIRV/doc.cpp -LOCAL_C_INCLUDES:=$(LOCAL_PATH) \ - $(LOCAL_PATH)/glslang/SPIRV \ - $(GLSLANG_GENERATED_INCLUDEDIR) -LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/glslang/SPIRV -LOCAL_STATIC_LIBRARIES:=glslang -include $(BUILD_STATIC_LIBRARY) diff --git a/lib/shaderc/third_party/glslang/BUILD.bazel b/lib/shaderc/third_party/glslang/BUILD.bazel deleted file mode 100644 index 1115b7de8..000000000 --- a/lib/shaderc/third_party/glslang/BUILD.bazel +++ /dev/null @@ -1,309 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -package( - default_visibility = ["//visibility:public"], -) - -# Description: -# -# Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator. - -licenses(["notice"]) - -exports_files(["LICENSE"]) - -# Build information generation script -py_binary( - name = "build_info", - srcs = ["build_info.py"], -) - -py_binary( - name = "gen_extension_headers", - srcs = ["gen_extension_headers.py"], -) - -genrule( - name = "gen_build_info_h", - srcs = ["CHANGES.md", "build_info.h.tmpl"], - outs = ["glslang/build_info.h"], - cmd_bash = "$(location build_info) $$(dirname $(location CHANGES.md)) -i $(location build_info.h.tmpl) -o $(location glslang/build_info.h)", - cmd_bat = "for %F in ($(location CHANGES.md)) do $(location build_info) %~dpF -i $(location build_info.h.tmpl) -o $(location glslang/build_info.h)", - tools = [":build_info"], -) - -genrule( - name = "gen_extension_headers_h", - srcs = ["glslang/ExtensionHeaders", "gen_extension_headers.py"], - outs = ["glslang/glsl_intrinsic_header.h"], - cmd_bash = "$(location gen_extension_headers) -i $(location glslang/ExtensionHeaders) -o $(location glslang/glsl_intrinsic_header.h)", - tools = [":gen_extension_headers"], -) - -COMMON_COPTS = select({ - "@bazel_tools//src/conditions:windows": [""], - "//conditions:default": [ - "-Wall", - "-Wuninitialized", - "-Wunused", - "-Wunused-local-typedefs", - "-Wunused-parameter", - "-Wunused-value", - "-Wunused-variable", - "-Wno-reorder", - "-std=c++11", - "-fvisibility=hidden", - "-fvisibility-inlines-hidden", - "-fno-exceptions", - "-fno-rtti", - ], -}) - -cc_library( - name = "glslang", - srcs = glob( - [ - "glslang/GenericCodeGen/*.cpp", - "glslang/HLSL/*.cpp", - "glslang/MachineIndependent/*.cpp", - "glslang/MachineIndependent/preprocessor/*.cpp", - ], - exclude = [ - "glslang/HLSL/pch.h", - "glslang/MachineIndependent/pch.h", - ], - ) + [ - "OGLCompilersDLL/InitializeDll.cpp", - ] + select({ - "@bazel_tools//src/conditions:windows": - ["glslang/OSDependent/Windows/ossource.cpp"], - "//conditions:default": - ["glslang/OSDependent/Unix/ossource.cpp"], - }), - hdrs = glob([ - "glslang/HLSL/*.h", - "glslang/Include/*.h", - "glslang/MachineIndependent/*.h", - "glslang/MachineIndependent/preprocessor/*.h", - ]) + [ - "OGLCompilersDLL/InitializeDll.h", - "StandAlone/DirStackFileIncluder.h", - "glslang/OSDependent/osinclude.h", - "glslang/Public/ShaderLang.h", - ":gen_build_info_h", - ], - copts = COMMON_COPTS, - defines = [ - "AMD_EXTENSIONS", - "ENABLE_HLSL=0", - "ENABLE_OPT=0", - "NV_EXTENSIONS", - ], - linkopts = select({ - "@bazel_tools//src/conditions:windows": [""], - "//conditions:default": ["-lm", "-lpthread"], - }), - linkstatic = 1, -) - -genrule( - name = "export_spirv_headers", - srcs = [ - "SPIRV/GLSL.ext.AMD.h", - "SPIRV/GLSL.ext.EXT.h", - "SPIRV/GLSL.ext.KHR.h", - "SPIRV/GLSL.ext.NV.h", - "SPIRV/GLSL.std.450.h", - "SPIRV/NonSemanticDebugPrintf.h", - "SPIRV/spirv.hpp", - ], - outs = [ - "include/SPIRV/GLSL.ext.AMD.h", - "include/SPIRV/GLSL.ext.EXT.h", - "include/SPIRV/GLSL.ext.KHR.h", - "include/SPIRV/GLSL.ext.NV.h", - "include/SPIRV/GLSL.std.450.h", - "include/SPIRV/NonSemanticDebugPrintf.h", - "include/SPIRV/spirv.hpp", - ], - cmd_bash = "mkdir -p $(@D)/include/SPIRV && cp $(SRCS) $(@D)/include/SPIRV/", - cmd_bat = "(if not exist $(@D)\\include\\SPIRV mkdir $(@D)\\include\\SPIRV) && (for %S in ($(SRCS)) do @xcopy /q %S $(@D)\\include\\SPIRV\\ >NUL)", -) - -cc_library( - name = "SPIRV_headers", - hdrs = [":export_spirv_headers"], - copts = COMMON_COPTS, - includes = [ - "include", - "include/SPIRV", - ], - linkstatic = 1, -) - -cc_library( - name = "SPIRV", - srcs = glob( - ["SPIRV/*.cpp"], - exclude = [ - "SPIRV/SpvTools.cpp", - ], - ), - hdrs = [ - "SPIRV/GlslangToSpv.h", - "SPIRV/Logger.h", - "SPIRV/SPVRemapper.h", - "SPIRV/SpvBuilder.h", - "SPIRV/SpvTools.h", - "SPIRV/bitutils.h", - "SPIRV/disassemble.h", - "SPIRV/doc.h", - "SPIRV/hex_float.h", - "SPIRV/spvIR.h", - ], - copts = COMMON_COPTS, - includes = ["SPIRV"], - linkopts = select({ - "@bazel_tools//src/conditions:windows": [""], - "//conditions:default": ["-lm"], - }), - linkstatic = 1, - deps = [ - ":SPIRV_headers", - ":glslang", - ], -) - -cc_library( - name = "glslang-default-resource-limits", - srcs = ["StandAlone/ResourceLimits.cpp"], - hdrs = ["StandAlone/ResourceLimits.h"], - copts = COMMON_COPTS, - linkstatic = 1, - deps = [":glslang"], -) - -cc_binary( - name = "glslangValidator", - srcs = [ - "StandAlone/StandAlone.cpp", - "StandAlone/Worklist.h", - ":glslang/glsl_intrinsic_header.h" - ], - copts = COMMON_COPTS, - deps = [ - ":SPIRV", - ":glslang", - ":glslang-default-resource-limits", - ], -) - -cc_binary( - name = "spirv-remap", - srcs = ["StandAlone/spirv-remap.cpp"], - copts = COMMON_COPTS, - deps = [ - ":SPIRV", - ":glslang", - ":glslang-default-resource-limits", - ], -) - -filegroup( - name = "test_files", - srcs = glob( - ["Test/**"], - exclude = [ - "Test/bump", - "Test/glslangValidator", - "Test/runtests", - ], - ), -) - -cc_library( - name = "glslang_test_lib", - testonly = 1, - srcs = [ - "gtests/HexFloat.cpp", - "gtests/Initializer.h", - "gtests/Settings.cpp", - "gtests/Settings.h", - "gtests/TestFixture.cpp", - "gtests/TestFixture.h", - "gtests/main.cpp", - ], - copts = COMMON_COPTS, - data = [":test_files"], - defines = select({ - # Unfortunately we can't use $(location) in cc_library at the moment. - # See https://github.com/bazelbuild/bazel/issues/1023 - # So we'll specify the path manually. - "@bazel_tools//src/conditions:windows": - ["GLSLANG_TEST_DIRECTORY='\"../../../../../Test\"'"], - "//conditions:default": - ["GLSLANG_TEST_DIRECTORY='\"Test\"'"], - }), - linkstatic = 1, - deps = [ - ":SPIRV", - ":glslang", - ":glslang-default-resource-limits", - "@com_google_googletest//:gtest", - ], -) - -GLSLANG_TESTS = glob( - ["gtests/*.FromFile.cpp"], - # Since we are not building the SPIRV-Tools dependency, the following tests - # cannot be performed. - exclude = [ - "gtests/Hlsl.FromFile.cpp", - "gtests/Spv.FromFile.cpp", - ], -) - -[cc_test( - name = test_file.replace("gtests/", "").replace(".FromFile.cpp", "") + "_test", - srcs = [test_file], - copts = COMMON_COPTS, - data = [ - ":test_files", - ], - deps = [ - ":SPIRV", - ":glslang", - ":glslang_test_lib", - ], -) for test_file in GLSLANG_TESTS] diff --git a/lib/shaderc/third_party/glslang/BUILD.gn b/lib/shaderc/third_party/glslang/BUILD.gn deleted file mode 100644 index 4dd0a5539..000000000 --- a/lib/shaderc/third_party/glslang/BUILD.gn +++ /dev/null @@ -1,353 +0,0 @@ -# Copyright (C) 2018 Google, Inc. -# -# 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. - -import("//build_overrides/glslang.gni") - -# Both Chromium and Fuchsia use by default a set of warning errors -# that is far too strict to compile this project. These are also -# typically appended after |cflags|, overriding target-specific -# definitions. To work around this, determine which configs to -# add and remove in order to succesfully build the project. -if (defined(is_fuchsia_tree) && is_fuchsia_tree) { - _configs_to_remove = [ "//build/config:default_warnings" ] - _configs_to_add = [] -} else { - _configs_to_remove = [ "//build/config/compiler:chromium_code" ] - _configs_to_add = [ "//build/config/compiler:no_chromium_code" ] -} - -action("glslang_build_info") { - script = "build_info.py" - - src_dir = "." - changes_file = "CHANGES.md" - template_file = "build_info.h.tmpl" - out_file = "${target_gen_dir}/include/glslang/build_info.h" - - inputs = [ - changes_file, - script, - template_file, - ] - outputs = [ out_file ] - args = [ - rebase_path(src_dir, root_build_dir), - "-i", - rebase_path(template_file, root_build_dir), - "-o", - rebase_path(out_file, root_build_dir), - ] -} - -action("glslang_extension_headers") { - script = "gen_extension_headers.py" - - out_file = "${target_gen_dir}/include/glslang/glsl_intrinsic_header.h" - - # Fuchsia GN build rules require all GN actions to be hermetic and they - # should correctly and fully state their inputs and outpus (see - # https://fuchsia.dev/fuchsia-src/development/build/hermetic_actions - # for details). All input files of the script should be added to the - # |sources| list. - sources = [ - "glslang/ExtensionHeaders/GL_EXT_shader_realtime_clock.glsl", - ] - - inputs = [ - script - ] - outputs = [ out_file ] - args = [ - "-i", - rebase_path("glslang/ExtensionHeaders", root_build_dir), - "-o", - rebase_path(out_file, root_build_dir), - ] -} - -spirv_tools_dir = glslang_spirv_tools_dir -if (!defined(glslang_angle)) { - glslang_angle = false -} - -config("glslang_public") { - include_dirs = [ "." ] - if (!is_win || is_clang) { - cflags = [ "-Wno-conversion" ] - } -} - -config("glslang_hlsl") { - defines = [ "ENABLE_HLSL=1" ] -} - -template("glslang_sources_common") { - source_set(target_name) { - public_configs = [ ":glslang_public" ] - - if (invoker.enable_hlsl) { - public_configs += [ ":glslang_hlsl" ] - } - - sources = [ - "OGLCompilersDLL/InitializeDll.cpp", - "OGLCompilersDLL/InitializeDll.h", - "SPIRV/GLSL.ext.AMD.h", - "SPIRV/GLSL.ext.EXT.h", - "SPIRV/GLSL.ext.KHR.h", - "SPIRV/GLSL.ext.NV.h", - "SPIRV/GLSL.std.450.h", - "SPIRV/GlslangToSpv.cpp", - "SPIRV/GlslangToSpv.h", - "SPIRV/InReadableOrder.cpp", - "SPIRV/Logger.cpp", - "SPIRV/Logger.h", - "SPIRV/NonSemanticDebugPrintf.h", - "SPIRV/SPVRemapper.cpp", - "SPIRV/SPVRemapper.h", - "SPIRV/SpvBuilder.cpp", - "SPIRV/SpvBuilder.h", - "SPIRV/SpvPostProcess.cpp", - "SPIRV/SpvTools.h", - "SPIRV/bitutils.h", - "SPIRV/disassemble.cpp", - "SPIRV/disassemble.h", - "SPIRV/doc.cpp", - "SPIRV/doc.h", - "SPIRV/hex_float.h", - "SPIRV/spirv.hpp", - "SPIRV/spvIR.h", - "glslang/GenericCodeGen/CodeGen.cpp", - "glslang/GenericCodeGen/Link.cpp", - "glslang/Include/BaseTypes.h", - "glslang/Include/Common.h", - "glslang/Include/ConstantUnion.h", - "glslang/Include/InfoSink.h", - "glslang/Include/InitializeGlobals.h", - "glslang/Include/PoolAlloc.h", - "glslang/Include/ResourceLimits.h", - "glslang/Include/ShHandle.h", - "glslang/Include/SpirvIntrinsics.h", - "glslang/Include/Types.h", - "glslang/Include/arrays.h", - "glslang/Include/intermediate.h", - "glslang/MachineIndependent/Constant.cpp", - "glslang/MachineIndependent/InfoSink.cpp", - "glslang/MachineIndependent/Initialize.cpp", - "glslang/MachineIndependent/Initialize.h", - "glslang/MachineIndependent/IntermTraverse.cpp", - "glslang/MachineIndependent/Intermediate.cpp", - "glslang/MachineIndependent/LiveTraverser.h", - "glslang/MachineIndependent/ParseContextBase.cpp", - "glslang/MachineIndependent/ParseHelper.cpp", - "glslang/MachineIndependent/ParseHelper.h", - "glslang/MachineIndependent/PoolAlloc.cpp", - "glslang/MachineIndependent/RemoveTree.cpp", - "glslang/MachineIndependent/RemoveTree.h", - "glslang/MachineIndependent/Scan.cpp", - "glslang/MachineIndependent/Scan.h", - "glslang/MachineIndependent/ScanContext.h", - "glslang/MachineIndependent/ShaderLang.cpp", - "glslang/MachineIndependent/SpirvIntrinsics.cpp", - "glslang/MachineIndependent/SymbolTable.cpp", - "glslang/MachineIndependent/SymbolTable.h", - "glslang/MachineIndependent/Versions.cpp", - "glslang/MachineIndependent/Versions.h", - "glslang/MachineIndependent/attribute.cpp", - "glslang/MachineIndependent/attribute.h", - "glslang/MachineIndependent/gl_types.h", - "glslang/MachineIndependent/glslang_tab.cpp", - "glslang/MachineIndependent/glslang_tab.cpp.h", - "glslang/MachineIndependent/intermOut.cpp", - "glslang/MachineIndependent/iomapper.cpp", - "glslang/MachineIndependent/iomapper.h", - "glslang/MachineIndependent/limits.cpp", - "glslang/MachineIndependent/linkValidate.cpp", - "glslang/MachineIndependent/localintermediate.h", - "glslang/MachineIndependent/parseConst.cpp", - "glslang/MachineIndependent/parseVersions.h", - "glslang/MachineIndependent/preprocessor/Pp.cpp", - "glslang/MachineIndependent/preprocessor/PpAtom.cpp", - "glslang/MachineIndependent/preprocessor/PpContext.cpp", - "glslang/MachineIndependent/preprocessor/PpContext.h", - "glslang/MachineIndependent/preprocessor/PpScanner.cpp", - "glslang/MachineIndependent/preprocessor/PpTokens.cpp", - "glslang/MachineIndependent/preprocessor/PpTokens.h", - "glslang/MachineIndependent/propagateNoContraction.cpp", - "glslang/MachineIndependent/propagateNoContraction.h", - "glslang/MachineIndependent/reflection.cpp", - "glslang/MachineIndependent/reflection.h", - "glslang/OSDependent/osinclude.h", - "glslang/Public/ShaderLang.h", - ] - - # Workaround gn issue complaining about these not being allowed even though GLSLANG_HLSL is not - # defined. - sources += [ - "glslang/HLSL/hlslParseHelper.h", - "glslang/HLSL/hlslParseables.h", - "glslang/HLSL/hlslScanContext.h", - "glslang/HLSL/hlslTokens.h", - ] - - if (invoker.enable_hlsl) { - sources += [ - "glslang/HLSL/hlslAttributes.cpp", - "glslang/HLSL/hlslAttributes.h", - "glslang/HLSL/hlslGrammar.cpp", - "glslang/HLSL/hlslGrammar.h", - "glslang/HLSL/hlslOpMap.cpp", - "glslang/HLSL/hlslOpMap.h", - "glslang/HLSL/hlslParseHelper.cpp", - "glslang/HLSL/hlslParseables.cpp", - "glslang/HLSL/hlslScanContext.cpp", - "glslang/HLSL/hlslTokenStream.cpp", - "glslang/HLSL/hlslTokenStream.h", - ] - } - - defines = [] - if (invoker.enable_opt) { - sources += [ "SPIRV/SpvTools.cpp" ] - defines += [ "ENABLE_OPT=1" ] - } - if (invoker.is_angle) { - defines += [ "GLSLANG_ANGLE" ] - } - - if (is_win) { - sources += [ "glslang/OSDependent/Windows/ossource.cpp" ] - defines += [ "GLSLANG_OSINCLUDE_WIN32" ] - } else { - sources += [ "glslang/OSDependent/Unix/ossource.cpp" ] - defines += [ "GLSLANG_OSINCLUDE_UNIX" ] - } - - if (is_clang) { - cflags = [ - "-Wno-extra-semi", - "-Wno-ignored-qualifiers", - "-Wno-implicit-fallthrough", - "-Wno-inconsistent-missing-override", - "-Wno-missing-field-initializers", - "-Wno-newline-eof", - "-Wno-sign-compare", - "-Wno-suggest-destructor-override", - "-Wno-suggest-override", - "-Wno-unused-variable", - ] - } - if (is_win && !is_clang) { - cflags = [ - "/wd4018", # signed/unsigned mismatch - "/wd4189", # local variable is initialized but not referenced - ] - } - - include_dirs = [ "${target_gen_dir}/include" ] - - deps = [ ":glslang_build_info" ] - - if (invoker.enable_opt) { - deps += [ - "${spirv_tools_dir}:spvtools_opt", - "${spirv_tools_dir}:spvtools_val", - ] - include_dirs += [ "${spirv_tools_dir}/include" ] - } - - configs -= _configs_to_remove - configs += _configs_to_add - } -} - -glslang_sources_common("glslang_lib_sources") { - enable_opt = !glslang_angle - enable_hlsl = !glslang_angle - is_angle = glslang_angle -} - -glslang_sources_common("glslang_sources") { - enable_opt = true - enable_hlsl = true - is_angle = false -} - -source_set("glslang_default_resource_limits_sources") { - sources = [ - "StandAlone/ResourceLimits.cpp", - "StandAlone/ResourceLimits.h", - "glslang/Include/ResourceLimits.h", - ] - public_configs = [ ":glslang_public" ] - - configs -= _configs_to_remove - configs += _configs_to_add -} - -executable("glslang_validator") { - sources = [ - "StandAlone/DirStackFileIncluder.h", - "StandAlone/StandAlone.cpp", - ] - if (!is_win) { - cflags = [ "-Woverflow" ] - } - defines = [ "ENABLE_OPT=1" ] - deps = [ - ":glslang_build_info", - ":glslang_default_resource_limits_sources", - ":glslang_sources", - ":glslang_extension_headers", - ] - public_configs = [ ":glslang_hlsl" ] - - include_dirs = [ - "${target_gen_dir}/include", - "${spirv_tools_dir}/include", - ] - - configs -= _configs_to_remove - configs += _configs_to_add -} - -executable("spirv-remap") { - sources = [ "StandAlone/spirv-remap.cpp" ] - defines = [ "ENABLE_OPT=1" ] - deps = [ ":glslang_sources" ] - - include_dirs = [ "${spirv_tools_dir}/include" ] - - configs -= _configs_to_remove - configs += _configs_to_add -} diff --git a/lib/shaderc/third_party/glslang/CHANGES.md b/lib/shaderc/third_party/glslang/CHANGES.md deleted file mode 100644 index 6d3bd6d98..000000000 --- a/lib/shaderc/third_party/glslang/CHANGES.md +++ /dev/null @@ -1,96 +0,0 @@ -# Revision history for `glslang` - -All notable changes to this project will be documented in this file. -This project adheres to [Semantic Versioning](https://semver.org/). - -## 11.8.0 2022-01-27 - -### Other changes -* Add support for SPIR-V 1.6 -* Add support for Vulkan 1.3 -* Add --hlsl-dx-position-w option - -## 11.7.0 2021-11-11 - -### Other changes -* Add support for targeting Vulkan 1.2 in the C API - -## 11.6.0 2021-08-25 - -### Other changes -* Atomic memory function only for shader storage block member or shared variable -* Add support for gl_MaxVaryingVectors for ogl -* Fix loading bool arrays from interface blocks -* Generate separate stores for partially swizzled memory stores -* Allow layout(std430) uniform with GL_EXT_scalar_block_layout -* Support for pragma STDGL invariant(all) -* Support for GL_NV_ray_tracing_motion_blur - -## 11.5.0 2021-06-23 - -### Other changes -* Implement GLSL_EXT_shader_atomic_float2 -* Implement GL_EXT_spirv_intrinsics -* Fixed SPIR-V remapper not remapping OpExtInst instruction set IDs -* only declare compatibility gl_ variables in compatibility mode -* Add support for float spec const vector initialization -* Implement GL_EXT_subgroup_uniform_control_flow. -* Fix arrays dimensioned with spec constant sized gl_WorkGroupSize -* Add support for 64bit integer scalar and vector types to bitCount() builtin - -## 11.4.0 2021-04-22 - -### Other changes -* Fix to keep source compatible with CMake 3.10.2 - -## 11.3.0 2021-04-21 - -### Other changes -* Added --depfile -* Added --auto-sampled-textures -* Now supports InterpolateAt-based functions -* Supports cross-stage automatic IO mapping -* Supports GL_EXT_vulkan_glsl_relaxed (-R option) - -## 11.2.0 2021-02-18 - -### Other changes -* Removed Python requirement when not building with spirv-tools -* Add support for GL_EXT_shared_memory_block -* Implement GL_EXT_null_initializer -* Add CMake support for Fuschia - -## 11.1.0 2020-12-07 - -### Other changes -* Added ray-tracing extension support - -## 11.0.0 2020-07-20 - -### Breaking changes - -#### Visual Studio 2013 is no longer supported - -[As scheduled](https://github.com/KhronosGroup/glslang/blob/9eef54b2513ca6b40b47b07d24f453848b65c0df/README.md#planned-deprecationsremovals), -Microsoft Visual Studio 2013 is no longer officially supported. Please upgrade -to at least Visual Studio 2015. - -## 10.15.3847 2020-07-20 - -### Breaking changes - -* The following files have been removed: - * `glslang/include/revision.h` - * `glslang/include/revision.template` - -The `GLSLANG_MINOR_VERSION` and `GLSLANG_PATCH_LEVEL` defines have been removed -from the public headers. \ -Instead each build script now uses the new `build_info.py` -script along with the `build_info.h.tmpl` and this `CHANGES.md` file to generate -the glslang build-time generated header `glslang/build_info.h`. - -The new public API to obtain the `glslang` version is `glslang::GetVersion()`. - -### Other changes -* `glslang` shared objects produced by CMake are now `SONAME` versioned using - [Semantic Versioning 2.0.0](https://semver.org/). diff --git a/lib/shaderc/third_party/glslang/CMakeLists.txt b/lib/shaderc/third_party/glslang/CMakeLists.txt deleted file mode 100644 index 43533c14d..000000000 --- a/lib/shaderc/third_party/glslang/CMakeLists.txt +++ /dev/null @@ -1,365 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -# increase to 3.1 once all major distributions -# include a version of CMake >= 3.1 -cmake_minimum_required(VERSION 2.8.12) -if (POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) -endif() -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() - -project(glslang LANGUAGES CXX) - -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -# Enable compile commands database -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - -# Adhere to GNU filesystem layout conventions -include(GNUInstallDirs) - -# Needed for CMAKE_DEPENDENT_OPTION macro -include(CMakeDependentOption) - -option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF) -option(BUILD_EXTERNAL "Build external dependencies in /External" ON) - -set(LIB_TYPE STATIC) - -if(BUILD_SHARED_LIBS) - set(LIB_TYPE SHARED) -endif() - -if ("${CMAKE_BUILD_TYPE}" STREQUAL "") - # This logic inside SPIRV-Tools, which can upset build target dependencies - # if changed after targets are already defined. To prevent these issues, - # ensure CMAKE_BUILD_TYPE is assigned early and at the glslang root scope. - message(STATUS "No build type selected, default to Debug") - set(CMAKE_BUILD_TYPE "Debug") -endif() - -option(SKIP_GLSLANG_INSTALL "Skip installation" ${SKIP_GLSLANG_INSTALL}) -if(NOT ${SKIP_GLSLANG_INSTALL}) - set(ENABLE_GLSLANG_INSTALL ON) -endif() -option(ENABLE_SPVREMAPPER "Enables building of SPVRemapper" ON) - -option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON) - -option(ENABLE_GLSLANG_JS - "If using Emscripten, build glslang.js. Otherwise, builds a sample executable for binary-size testing." OFF) -CMAKE_DEPENDENT_OPTION(ENABLE_GLSLANG_WEBMIN - "Reduces glslang to minimum needed for web use" - OFF "ENABLE_GLSLANG_JS" - OFF) -CMAKE_DEPENDENT_OPTION(ENABLE_GLSLANG_WEBMIN_DEVEL - "For ENABLE_GLSLANG_WEBMIN builds, enables compilation error messages" - OFF "ENABLE_GLSLANG_WEBMIN" - OFF) -CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_SINGLE_FILE - "If using Emscripten, enables SINGLE_FILE build" - OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN" - OFF) -CMAKE_DEPENDENT_OPTION(ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE - "If using Emscripten, builds to run on Node instead of Web" - OFF "ENABLE_GLSLANG_JS AND EMSCRIPTEN" - OFF) - -CMAKE_DEPENDENT_OPTION(ENABLE_HLSL - "Enables HLSL input support" - ON "NOT ENABLE_GLSLANG_WEBMIN" - OFF) - -option(ENABLE_RTTI "Enables RTTI" OFF) -option(ENABLE_EXCEPTIONS "Enables Exceptions" OFF) -option(ENABLE_OPT "Enables spirv-opt capability if present" ON) - -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") - # Workaround for CMake behavior on Mac OS with gcc, cmake generates -Xarch_* arguments - # which gcc rejects - option(ENABLE_PCH "Enables Precompiled header" OFF) -else() - option(ENABLE_PCH "Enables Precompiled header" ON) -endif() -option(ENABLE_CTEST "Enables testing" ON) - -if(ENABLE_GLSLANG_INSTALL AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32) - set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE) -endif() - -option(USE_CCACHE "Use ccache" OFF) -if(USE_CCACHE) - find_program(CCACHE_FOUND ccache) - if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - endif() -endif() - -if(ENABLE_CTEST) - include(CTest) -endif() - -if(ENABLE_HLSL) - add_definitions(-DENABLE_HLSL) -endif() - -if(ENABLE_GLSLANG_WEBMIN) - add_definitions(-DGLSLANG_WEB) - if(ENABLE_GLSLANG_WEBMIN_DEVEL) - add_definitions(-DGLSLANG_WEB_DEVEL) - endif() -endif() - -if(WIN32) - set(CMAKE_DEBUG_POSTFIX "d") - option(OVERRIDE_MSVCCRT "Overrides runtime of MSVC " ON) - if(MSVC AND OVERRIDE_MSVCCRT) - include(ChooseMSVCCRT.cmake) - endif() - add_definitions(-DGLSLANG_OSINCLUDE_WIN32) -elseif(UNIX) - add_definitions(-DGLSLANG_OSINCLUDE_UNIX) -else() - message("unknown platform") -endif() - -if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") - add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs - -Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions) - add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over. - if(NOT ENABLE_RTTI) - add_compile_options(-fno-rtti) - endif() - if(NOT ENABLE_EXCEPTIONS) - add_compile_options(-fno-exceptions) - endif() - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0") - add_compile_options(-Werror=deprecated-copy) - endif() - - if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - # Error if there's symbols that are not found at link time. - # add_link_options() was added in CMake 3.13 - if using an earlier - # version don't set this - it should be caught by presubmits anyway. - add_link_options("-Wl,--no-undefined") - endif() -elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC) - add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs - -Wunused-parameter -Wunused-value -Wunused-variable) - add_compile_options(-Wno-reorder) # disable this from -Wall, since it happens all over. - if(NOT ENABLE_RTTI) - add_compile_options(-fno-rtti) - endif() - if(NOT ENABLE_EXCEPTIONS) - add_compile_options(-fno-exceptions) - endif() - - if(NOT CMAKE_VERSION VERSION_LESS "3.13") - # Error if there's symbols that are not found at link time. - # add_link_options() was added in CMake 3.13 - if using an earlier - # version don't set this - it should be caught by presubmits anyway. - add_link_options("-Wl,-undefined,error") - endif() -elseif(MSVC) - if(NOT ENABLE_RTTI) - string(FIND "${CMAKE_CXX_FLAGS}" "/GR" MSVC_HAS_GR) - if(MSVC_HAS_GR) - string(REGEX REPLACE "/GR" "/GR-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - else() - add_compile_options(/GR-) # Disable RTTI - endif() - endif() - if(ENABLE_EXCEPTIONS) - add_compile_options(/EHsc) # Enable Exceptions - else() - string(REGEX REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # Try to remove default /EHsc cxx_flag - add_compile_options(/D_HAS_EXCEPTIONS=0) - endif() -endif() - -if(ENABLE_GLSLANG_JS) - if(MSVC) - add_compile_options(/Os /GR-) - else() - add_compile_options(-Os -fno-rtti -fno-exceptions) - if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC) - add_compile_options(-Wno-unused-parameter) - add_compile_options(-Wno-unused-variable -Wno-unused-const-variable) - endif() - endif() -endif() - -# Request C++11 -if(${CMAKE_VERSION} VERSION_LESS 3.1) - # CMake versions before 3.1 do not understand CMAKE_CXX_STANDARD - # remove this block once CMake >=3.1 has fixated in the ecosystem - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -else() - set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED ON) - set(CMAKE_CXX_EXTENSIONS OFF) -endif() - -function(glslang_set_link_args TARGET) - # For MinGW compiles, statically link against the GCC and C++ runtimes. - # This avoids the need to ship those runtimes as DLLs. - if(WIN32 AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") - set_target_properties(${TARGET} PROPERTIES - LINK_FLAGS "-static -static-libgcc -static-libstdc++") - endif() -endfunction(glslang_set_link_args) - -if(NOT COMMAND find_host_package) - macro(find_host_package) - find_package(${ARGN}) - endmacro() -endif() - -# Root directory for build-time generated include files -set(GLSLANG_GENERATED_INCLUDEDIR "${CMAKE_BINARY_DIR}/include") - -################################################################################ -# Build version information generation -################################################################################ -include(parse_version.cmake) -set(GLSLANG_CHANGES_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CHANGES.md") -set(GLSLANG_BUILD_INFO_H_TMPL "${CMAKE_CURRENT_SOURCE_DIR}/build_info.h.tmpl") -set(GLSLANG_BUILD_INFO_H "${GLSLANG_GENERATED_INCLUDEDIR}/glslang/build_info.h") - -parse_version(${GLSLANG_CHANGES_FILE} GLSLANG) - -function(configurate_version) - set(major ${GLSLANG_VERSION_MAJOR}) - set(minor ${GLSLANG_VERSION_MINOR}) - set(patch ${GLSLANG_VERSION_PATCH}) - set(flavor ${GLSLANG_VERSION_FLAVOR}) - configure_file(${GLSLANG_BUILD_INFO_H_TMPL} ${GLSLANG_BUILD_INFO_H} @ONLY) -endfunction() - -configurate_version() - -# glslang_add_build_info_dependency() adds the glslang-build-info dependency and -# generated include directories to target. -function(glslang_add_build_info_dependency target) - target_include_directories(${target} PUBLIC $) -endfunction() - -# glslang_only_export_explicit_symbols() makes the symbol visibility hidden by -# default for when building shared libraries, and sets the -# GLSLANG_IS_SHARED_LIBRARY define, and GLSLANG_EXPORTING to 1 when specifically -# building . -function(glslang_only_export_explicit_symbols target) - if(BUILD_SHARED_LIBS) - target_compile_definitions(${target} PUBLIC "GLSLANG_IS_SHARED_LIBRARY=1") - if(WIN32) - target_compile_definitions(${target} PRIVATE "GLSLANG_EXPORTING=1") - else() - target_compile_options(${target} PRIVATE "-fvisibility=hidden") - endif() - endif() -endfunction() - -# glslang_pch() adds precompiled header rules to for the pre-compiled -# header file . As target_precompile_headers() was added in CMake 3.16, -# this is a no-op if called on earlier versions of CMake. -if(NOT CMAKE_VERSION VERSION_LESS "3.16" AND ENABLE_PCH) - function(glslang_pch target pch) - target_precompile_headers(${target} PRIVATE ${pch}) - endfunction() -else() - function(glslang_pch target pch) - endfunction() - if(ENABLE_PCH) - message("Your CMake version is ${CMAKE_VERSION}. Update to at least 3.16 to enable precompiled headers to speed up incremental builds") - endif() -endif() - -if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External) - find_host_package(PythonInterp 3 REQUIRED) - - # We depend on these for later projects, so they should come first. - add_subdirectory(External) -endif() - -if(NOT TARGET SPIRV-Tools-opt) - set(ENABLE_OPT OFF) -endif() - -if(ENABLE_OPT) - message(STATUS "optimizer enabled") - add_definitions(-DENABLE_OPT=1) -else() - if(ENABLE_HLSL) - message(STATUS "spirv-tools not linked - illegal SPIRV may be generated for HLSL") - endif() - add_definitions(-DENABLE_OPT=0) -endif() - -add_subdirectory(glslang) -add_subdirectory(OGLCompilersDLL) -if(ENABLE_GLSLANG_BINARIES) - add_subdirectory(StandAlone) -endif() -add_subdirectory(SPIRV) -if(ENABLE_HLSL) - add_subdirectory(hlsl) -endif() -if(ENABLE_CTEST) - add_subdirectory(gtests) -endif() - -if(ENABLE_CTEST AND BUILD_TESTING) - # glslang-testsuite runs a bash script on Windows. - # Make sure to use '-o igncr' flag to ignore carriage returns (\r). - set(IGNORE_CR_FLAG "") - if(WIN32) - set(IGNORE_CR_FLAG -o igncr) - endif() - - if (CMAKE_CONFIGURATION_TYPES) - set(RESULTS_PATH ${CMAKE_CURRENT_BINARY_DIR}/$/localResults) - set(VALIDATOR_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/$/glslangValidator) - set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/$/spirv-remap) - else() - set(RESULTS_PATH ${CMAKE_CURRENT_BINARY_DIR}/localResults) - set(VALIDATOR_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/glslangValidator) - set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/spirv-remap) - endif() - - add_test(NAME glslang-testsuite - COMMAND bash ${IGNORE_CR_FLAG} runtests ${RESULTS_PATH} ${VALIDATOR_PATH} ${REMAP_PATH} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Test/) -endif() diff --git a/lib/shaderc/third_party/glslang/CODE_OF_CONDUCT.md b/lib/shaderc/third_party/glslang/CODE_OF_CONDUCT.md deleted file mode 100644 index a11610bd3..000000000 --- a/lib/shaderc/third_party/glslang/CODE_OF_CONDUCT.md +++ /dev/null @@ -1 +0,0 @@ -A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil. diff --git a/lib/shaderc/third_party/glslang/ChooseMSVCCRT.cmake b/lib/shaderc/third_party/glslang/ChooseMSVCCRT.cmake deleted file mode 100644 index b1561263c..000000000 --- a/lib/shaderc/third_party/glslang/ChooseMSVCCRT.cmake +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -# The macro choose_msvc_crt() takes a list of possible -# C runtimes to choose from, in the form of compiler flags, -# to present to the user. (MTd for /MTd, etc) -# -# The macro is invoked at the end of the file. -# -# CMake already sets CRT flags in the CMAKE_CXX_FLAGS_* and -# CMAKE_C_FLAGS_* variables by default. To let the user -# override that for each build type: -# 1. Detect which CRT is already selected, and reflect this in -# LLVM_USE_CRT_* so the user can have a better idea of what -# changes they're making. -# 2. Replace the flags in both variables with the new flag via a regex. -# 3. set() the variables back into the cache so the changes -# are user-visible. - -### Helper macros: ### -macro(make_crt_regex regex crts) - set(${regex} "") - foreach(crt ${${crts}}) - # Trying to match the beginning or end of the string with stuff - # like [ ^]+ didn't work, so use a bunch of parentheses instead. - set(${regex} "${${regex}}|(^| +)/${crt}($| +)") - endforeach(crt) - string(REGEX REPLACE "^\\|" "" ${regex} "${${regex}}") -endmacro(make_crt_regex) - -macro(get_current_crt crt_current regex flagsvar) - # Find the selected-by-CMake CRT for each build type, if any. - # Strip off the leading slash and any whitespace. - string(REGEX MATCH "${${regex}}" ${crt_current} "${${flagsvar}}") - string(REPLACE "/" " " ${crt_current} "${${crt_current}}") - string(STRIP "${${crt_current}}" ${crt_current}) -endmacro(get_current_crt) - -# Replaces or adds a flag to a variable. -# Expects 'flag' to be padded with spaces. -macro(set_flag_in_var flagsvar regex flag) - string(REGEX MATCH "${${regex}}" current_flag "${${flagsvar}}") - if("${current_flag}" STREQUAL "") - set(${flagsvar} "${${flagsvar}}${${flag}}") - else() - string(REGEX REPLACE "${${regex}}" "${${flag}}" ${flagsvar} "${${flagsvar}}") - endif() - string(STRIP "${${flagsvar}}" ${flagsvar}) - # Make sure this change gets reflected in the cache/gui. - # CMake requires the docstring parameter whenever set() touches the cache, - # so get the existing docstring and re-use that. - get_property(flagsvar_docs CACHE ${flagsvar} PROPERTY HELPSTRING) - set(${flagsvar} "${${flagsvar}}" CACHE STRING "${flagsvar_docs}" FORCE) -endmacro(set_flag_in_var) - - -macro(choose_msvc_crt MSVC_CRT) - if(LLVM_USE_CRT) - message(FATAL_ERROR - "LLVM_USE_CRT is deprecated. Use the CMAKE_BUILD_TYPE-specific -variables (LLVM_USE_CRT_DEBUG, etc) instead.") - endif() - - make_crt_regex(MSVC_CRT_REGEX ${MSVC_CRT}) - - foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) - string(TOUPPER "${build_type}" build) - if (NOT LLVM_USE_CRT_${build}) - get_current_crt(LLVM_USE_CRT_${build} - MSVC_CRT_REGEX - CMAKE_CXX_FLAGS_${build}) - set(LLVM_USE_CRT_${build} - "${LLVM_USE_CRT_${build}}" - CACHE STRING "Specify VC++ CRT to use for ${build_type} configurations." - FORCE) - set_property(CACHE LLVM_USE_CRT_${build} - PROPERTY STRINGS ;${${MSVC_CRT}}) - endif(NOT LLVM_USE_CRT_${build}) - endforeach(build_type) - - foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) - string(TOUPPER "${build_type}" build) - if ("${LLVM_USE_CRT_${build}}" STREQUAL "") - set(flag_string " ") - else() - set(flag_string " /${LLVM_USE_CRT_${build}} ") - list(FIND ${MSVC_CRT} ${LLVM_USE_CRT_${build}} idx) - if (idx LESS 0) - message(FATAL_ERROR - "Invalid value for LLVM_USE_CRT_${build}: ${LLVM_USE_CRT_${build}}. Valid options are one of: ${${MSVC_CRT}}") - endif (idx LESS 0) - message(STATUS "Using ${build_type} VC++ CRT: ${LLVM_USE_CRT_${build}}") - endif() - foreach(lang C CXX) - set_flag_in_var(CMAKE_${lang}_FLAGS_${build} MSVC_CRT_REGEX flag_string) - endforeach(lang) - endforeach(build_type) -endmacro(choose_msvc_crt MSVC_CRT) - - -# List of valid CRTs for MSVC -set(MSVC_CRT - MD - MDd - MT - MTd) - -choose_msvc_crt(MSVC_CRT) diff --git a/lib/shaderc/third_party/glslang/DEPS b/lib/shaderc/third_party/glslang/DEPS deleted file mode 100644 index 2f5fa8ef8..000000000 --- a/lib/shaderc/third_party/glslang/DEPS +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -use_relative_paths = True - -gclient_gn_args_file = 'build/config/gclient_args.gni' - -vars = { - 'chromium_git': 'https://chromium.googlesource.com', - 'build_with_chromium': False, -} - -deps = { - - './build': { - 'url': '{chromium_git}/chromium/src/build.git@85ee3b7692e5284f08bd3c9459fb5685eed7b838', - 'condition': 'not build_with_chromium', - }, - - './buildtools': { - 'url': '{chromium_git}/chromium/src/buildtools.git@4be464e050b3d05060471788f926b34c641db9fd', - 'condition': 'not build_with_chromium', - }, - - './tools/clang': { - 'url': '{chromium_git}/chromium/src/tools/clang.git@3a982adabb720aa8f3e3885d40bf3fe506990157', - 'condition': 'not build_with_chromium', - }, - -} - -hooks = [ - { - 'name': 'sysroot_x64', - 'pattern': '.', - 'condition': 'checkout_linux and (checkout_x64 and not build_with_chromium)', - 'action': ['python', './build/linux/sysroot_scripts/install-sysroot.py', - '--arch=x64'], - }, - { - # Note: On Win, this should run after win_toolchain, as it may use it. - 'name': 'clang', - 'pattern': '.', - 'action': ['python', './tools/clang/scripts/update.py'], - 'condition': 'not build_with_chromium', - }, -] - -recursedeps = [ - # buildtools provides clang_format, libc++, and libc++abi - 'buildtools', -] diff --git a/lib/shaderc/third_party/glslang/External/CMakeLists.txt b/lib/shaderc/third_party/glslang/External/CMakeLists.txt deleted file mode 100644 index cbabd2e3b..000000000 --- a/lib/shaderc/third_party/glslang/External/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -# Suppress all warnings from external projects. -set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -w) - -if(BUILD_TESTING) - if(TARGET gmock) - message(STATUS "Google Mock already configured - use it") - elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/googletest) - # We need to make sure Google Test does not mess up with the - # global CRT settings on Windows. - if(WIN32) - set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - endif(WIN32) - # EXCLUDE_FROM_ALL keeps the install target from installing GTEST files. - add_subdirectory(googletest EXCLUDE_FROM_ALL) - set(GTEST_TARGETS - gtest - gtest_main - gmock - gmock_main) - foreach(target ${GTEST_TARGETS}) - set_property(TARGET ${target} PROPERTY FOLDER gtest) - endforeach() - mark_as_advanced(gmock_build_tests - BUILD_GMOCK - BUILD_GTEST - BUILD_SHARED_LIBS - gtest_build_samples - gtest_build_tests - gtest_disable_pthreads - gtest_force_shared_crt - gtest_hide_internal_symbols) - else() - message(STATUS - "Google Mock was not found - tests based on that will not build") - endif() -endif() - -if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt) - if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools) - set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests") - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools spirv-tools) - endif() -endif() - diff --git a/lib/shaderc/third_party/glslang/LICENSE.txt b/lib/shaderc/third_party/glslang/LICENSE.txt deleted file mode 100644 index 054e68a46..000000000 --- a/lib/shaderc/third_party/glslang/LICENSE.txt +++ /dev/null @@ -1,1016 +0,0 @@ -Here, glslang proper means core GLSL parsing, HLSL parsing, and SPIR-V code -generation. Glslang proper requires use of a number of licenses, one that covers -preprocessing and others that covers non-preprocessing. - -Bison was removed long ago. You can build glslang from the source grammar, -using tools of your choice, without using bison or any bison files. - -Other parts, outside of glslang proper, include: - -- gl_types.h, only needed for OpenGL-like reflection, and can be left out of - a parse and codegen project. See it for its license. - -- update_glslang_sources.py, which is not part of the project proper and does - not need to be used. - -- the SPIR-V "remapper", which is optional, but has the same license as - glslang proper - -- Google tests and SPIR-V tools, and anything in the external subdirectory - are external and optional; see them for their respective licenses. - --------------------------------------------------------------------------------- - -The core of glslang-proper, minus the preprocessor is licenced as follows: - --------------------------------------------------------------------------------- -3-Clause BSD License --------------------------------------------------------------------------------- - -// -// Copyright (C) 2015-2018 Google, Inc. -// Copyright (C) -// -// 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 3Dlabs Inc. Ltd. 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. -// - - --------------------------------------------------------------------------------- -2-Clause BSD License --------------------------------------------------------------------------------- - -Copyright 2020 The Khronos Group Inc - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. 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. - -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 HOLDER 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. - - --------------------------------------------------------------------------------- -The MIT License --------------------------------------------------------------------------------- - -Copyright 2020 The Khronos Group Inc - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - --------------------------------------------------------------------------------- -APACHE LICENSE, VERSION 2.0 --------------------------------------------------------------------------------- - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - --------------------------------------------------------------------------------- -GPL 3 with special bison exception --------------------------------------------------------------------------------- - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - -Bison Exception - -As a special exception, you may create a larger work that contains part or all -of the Bison parser skeleton and distribute that work under terms of your -choice, so long as that work isn't itself a parser generator using the skeleton -or a modified version thereof as a parser skeleton. Alternatively, if you -modify or redistribute the parser skeleton itself, you may (at your option) -remove this special exception, which will cause the skeleton and the resulting -Bison output files to be licensed under the GNU General Public License without -this special exception. - -This special exception was added by the Free Software Foundation in version -2.2 of Bison. - - END OF TERMS AND CONDITIONS - --------------------------------------------------------------------------------- -================================================================================ --------------------------------------------------------------------------------- - -The preprocessor has the core licenses stated above, plus additional licences: - -/****************************************************************************\ -Copyright (c) 2002, NVIDIA Corporation. - -NVIDIA Corporation("NVIDIA") supplies this software to you in -consideration of your agreement to the following terms, and your use, -installation, modification or redistribution of this NVIDIA software -constitutes acceptance of these terms. If you do not agree with these -terms, please do not use, install, modify or redistribute this NVIDIA -software. - -In consideration of your agreement to abide by the following terms, and -subject to these terms, NVIDIA grants you a personal, non-exclusive -license, under NVIDIA's copyrights in this original NVIDIA software (the -"NVIDIA Software"), to use, reproduce, modify and redistribute the -NVIDIA Software, with or without modifications, in source and/or binary -forms; provided that if you redistribute the NVIDIA Software, you must -retain the copyright notice of NVIDIA, this notice and the following -text and disclaimers in all such redistributions of the NVIDIA Software. -Neither the name, trademarks, service marks nor logos of NVIDIA -Corporation may be used to endorse or promote products derived from the -NVIDIA Software without specific prior written permission from NVIDIA. -Except as expressly stated in this notice, no other rights or licenses -express or implied, are granted by NVIDIA herein, including but not -limited to any patent rights that may be infringed by your derivative -works or by other works in which the NVIDIA Software may be -incorporated. No hardware is licensed hereunder. - -THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, -INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER -PRODUCTS. - -IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, -INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY -OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE -NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, -TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\****************************************************************************/ - -/* -** Copyright (c) 2014-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ diff --git a/lib/shaderc/third_party/glslang/OGLCompilersDLL/CMakeLists.txt b/lib/shaderc/third_party/glslang/OGLCompilersDLL/CMakeLists.txt deleted file mode 100644 index 0b007d45c..000000000 --- a/lib/shaderc/third_party/glslang/OGLCompilersDLL/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -set(SOURCES InitializeDll.cpp InitializeDll.h) - -add_library(OGLCompiler STATIC ${SOURCES}) -set_property(TARGET OGLCompiler PROPERTY FOLDER glslang) -set_property(TARGET OGLCompiler PROPERTY POSITION_INDEPENDENT_CODE ON) - -if(WIN32) - source_group("Source" FILES ${SOURCES}) -endif(WIN32) - -if(ENABLE_GLSLANG_INSTALL) - install(TARGETS OGLCompiler EXPORT OGLCompilerTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install(EXPORT OGLCompilerTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) -endif(ENABLE_GLSLANG_INSTALL) diff --git a/lib/shaderc/third_party/glslang/OGLCompilersDLL/InitializeDll.cpp b/lib/shaderc/third_party/glslang/OGLCompilersDLL/InitializeDll.cpp deleted file mode 100644 index abea9108b..000000000 --- a/lib/shaderc/third_party/glslang/OGLCompilersDLL/InitializeDll.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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. -// - -#define SH_EXPORTING - -#include - -#include "InitializeDll.h" -#include "../glslang/Include/InitializeGlobals.h" -#include "../glslang/Public/ShaderLang.h" -#include "../glslang/Include/PoolAlloc.h" - -namespace glslang { - -OS_TLSIndex ThreadInitializeIndex = OS_INVALID_TLS_INDEX; - -// Per-process initialization. -// Needs to be called at least once before parsing, etc. is done. -// Will also do thread initialization for the calling thread; other -// threads will need to do that explicitly. -bool InitProcess() -{ - glslang::GetGlobalLock(); - - if (ThreadInitializeIndex != OS_INVALID_TLS_INDEX) { - // - // Function is re-entrant. - // - - glslang::ReleaseGlobalLock(); - return true; - } - - ThreadInitializeIndex = OS_AllocTLSIndex(); - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "InitProcess(): Failed to allocate TLS area for init flag"); - - glslang::ReleaseGlobalLock(); - return false; - } - - if (! InitializePoolIndex()) { - assert(0 && "InitProcess(): Failed to initialize global pool"); - - glslang::ReleaseGlobalLock(); - return false; - } - - if (! InitThread()) { - assert(0 && "InitProcess(): Failed to initialize thread"); - - glslang::ReleaseGlobalLock(); - return false; - } - - glslang::ReleaseGlobalLock(); - return true; -} - -// Per-thread scoped initialization. -// Must be called at least once by each new thread sharing the -// symbol tables, etc., needed to parse. -bool InitThread() -{ - // - // This function is re-entrant - // - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) { - assert(0 && "InitThread(): Process hasn't been initalised."); - return false; - } - - if (OS_GetTLSValue(ThreadInitializeIndex) != 0) - return true; - - if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) { - assert(0 && "InitThread(): Unable to set init flag."); - return false; - } - - glslang::SetThreadPoolAllocator(nullptr); - - return true; -} - -// Not necessary to call this: InitThread() is reentrant, and the need -// to do per thread tear down has been removed. -// -// This is kept, with memory management removed, to satisfy any exiting -// calls to it that rely on it. -bool DetachThread() -{ - bool success = true; - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) - return true; - - // - // Function is re-entrant and this thread may not have been initialized. - // - if (OS_GetTLSValue(ThreadInitializeIndex) != 0) { - if (!OS_SetTLSValue(ThreadInitializeIndex, (void *)0)) { - assert(0 && "DetachThread(): Unable to clear init flag."); - success = false; - } - } - - return success; -} - -// Not necessary to call this: InitProcess() is reentrant. -// -// This is kept, with memory management removed, to satisfy any exiting -// calls to it that rely on it. -// -// Users of glslang should call shFinalize() or glslang::FinalizeProcess() for -// process-scoped memory tear down. -bool DetachProcess() -{ - bool success = true; - - if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX) - return true; - - success = DetachThread(); - - OS_FreeTLSIndex(ThreadInitializeIndex); - ThreadInitializeIndex = OS_INVALID_TLS_INDEX; - - return success; -} - -} // end namespace glslang diff --git a/lib/shaderc/third_party/glslang/OGLCompilersDLL/InitializeDll.h b/lib/shaderc/third_party/glslang/OGLCompilersDLL/InitializeDll.h deleted file mode 100644 index 661cee4d2..000000000 --- a/lib/shaderc/third_party/glslang/OGLCompilersDLL/InitializeDll.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (C) 2002-2005 3Dlabs Inc. Ltd. -// 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 3Dlabs Inc. Ltd. 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. -// -#ifndef __INITIALIZEDLL_H -#define __INITIALIZEDLL_H - -#include "../glslang/OSDependent/osinclude.h" - -namespace glslang { - -bool InitProcess(); -bool InitThread(); -bool DetachThread(); // not called from standalone, perhaps other tools rely on parts of it -bool DetachProcess(); // not called from standalone, perhaps other tools rely on parts of it - -} // end namespace glslang - -#endif // __INITIALIZEDLL_H - diff --git a/lib/shaderc/third_party/glslang/README-spirv-remap.txt b/lib/shaderc/third_party/glslang/README-spirv-remap.txt deleted file mode 100644 index 3e5288aac..000000000 --- a/lib/shaderc/third_party/glslang/README-spirv-remap.txt +++ /dev/null @@ -1,137 +0,0 @@ - -VERSION --------------------------------------------------------------------------------- -spirv-remap 0.97 - -INTRO: --------------------------------------------------------------------------------- -spirv-remap is a utility to improve compression of SPIR-V binary files via -entropy reduction, plus optional stripping of debug information and -load/store optimization. It transforms SPIR-V to SPIR-V, remapping IDs. The -resulting modules have an increased ID range (IDs are not as tightly packed -around zero), but will compress better when multiple modules are compressed -together, since compressor's dictionary can find better cross module -commonality. - -Remapping is accomplished via canonicalization. Thus, modules can be -compressed one at a time with no loss of quality relative to operating on -many modules at once. The command line tool operates on multiple modules -only in the trivial repetition sense, for ease of use. The remapper API -only accepts a single module at a time. - -There are two modes of use: command line, and a C++11 API. Both are -described below. - -spirv-remap is currently in an alpha state. Although there are no known -remapping defects, it has only been exercised on one real world game shader -workload. - - -FEEDBACK --------------------------------------------------------------------------------- -Report defects, enhancements requests, code improvements, etc to: - spvremapper@lunarg.com - - -COMMAND LINE USAGE: --------------------------------------------------------------------------------- -Examples are given with a verbosity of one (-v), but more verbosity can be -had via -vv, -vvv, etc, or an integer parameter to --verbose, such as -"--verbose 4". With no verbosity, the command is silent and returns 0 on -success, and a positive integer error on failure. - -Pre-built binaries for several OSs are available. Examples presented are -for Linux. Command line arguments can be provided in any order. - -1. Basic ID remapping - -Perform ID remapping on all shaders in "*.spv", writing new files with -the same basenames to /tmp/out_dir. - - spirv-remap -v --map all --input *.spv --output /tmp/out_dir - -2. Perform all possible size reductions - - spirv-remap-linux-64 -v --do-everything --input *.spv --output /tmp/out_dir - -Note that --do-everything is a synonym for: - - --map all --dce all --opt all --strip all - -API USAGE: --------------------------------------------------------------------------------- - -The public interface to the remapper is defined in SPIRV/SPVRemapper.h as follows: - -namespace spv { - -class spirvbin_t -{ -public: - enum Options { ... }; - spirvbin_t(int verbose = 0); // construct - - // remap an existing binary in memory - void remap(std::vector& spv, std::uint32_t opts = DO_EVERYTHING); - - // Type for error/log handler functions - typedef std::function errorfn_t; - typedef std::function logfn_t; - - // Register error/log handling functions (can be c/c++ fn, lambda fn, or functor) - static void registerErrorHandler(errorfn_t handler) { errorHandler = handler; } - static void registerLogHandler(logfn_t handler) { logHandler = handler; } -}; - -} // namespace spv - -The class definition is in SPVRemapper.cpp. - -remap() accepts an std::vector of SPIR-V words, modifies them per the -request given in 'opts', and leaves the 'spv' container with the result. -It is safe to instantiate one spirvbin_t per thread and process a different -SPIR-V in each. - -The "opts" parameter to remap() accepts a bit mask of desired remapping -options. See REMAPPING AND OPTIMIZATION OPTIONS. - -On error, the function supplied to registerErrorHandler() will be invoked. -This can be a standard C/C++ function, a lambda function, or a functor. -The default handler simply calls exit(5); The error handler is a static -member, so need only be set up once, not once per spirvbin_t instance. - -Log messages are supplied to registerLogHandler(). By default, log -messages are eaten silently. The log handler is also a static member. - -BUILD DEPENDENCIES: --------------------------------------------------------------------------------- - 1. C++11 compatible compiler - 2. cmake - 3. glslang - - -BUILDING --------------------------------------------------------------------------------- -The standalone remapper is built along side glslangValidator through its -normal build process. - - -REMAPPING AND OPTIMIZATION OPTIONS --------------------------------------------------------------------------------- -API: - These are bits defined under spv::spirvbin_t::, and can be - bitwise or-ed together as desired. - - MAP_TYPES = canonicalize type IDs - MAP_NAMES = canonicalize named data - MAP_FUNCS = canonicalize function bodies - DCE_FUNCS = remove dead functions - DCE_VARS = remove dead variables - DCE_TYPES = remove dead types - OPT_LOADSTORE = optimize unneeded load/stores - MAP_ALL = (MAP_TYPES | MAP_NAMES | MAP_FUNCS) - DCE_ALL = (DCE_FUNCS | DCE_VARS | DCE_TYPES) - OPT_ALL = (OPT_LOADSTORE) - ALL_BUT_STRIP = (MAP_ALL | DCE_ALL | OPT_ALL) - DO_EVERYTHING = (STRIP | ALL_BUT_STRIP) - diff --git a/lib/shaderc/third_party/glslang/README.md b/lib/shaderc/third_party/glslang/README.md deleted file mode 100644 index 1eba3c606..000000000 --- a/lib/shaderc/third_party/glslang/README.md +++ /dev/null @@ -1,479 +0,0 @@ -# News - -1. Visual Studio 2013 is no longer supported - - [As scheduled](https://github.com/KhronosGroup/glslang/blob/9eef54b2513ca6b40b47b07d24f453848b65c0df/README.md#planned-deprecationsremovals), -Microsoft Visual Studio 2013 is no longer officially supported. \ - Please upgrade to at least Visual Studio 2015. - -2. The versioning scheme is being improved, and you might notice some differences. This is currently WIP, but will be coming soon. See, for example, PR #2277. - -3. If you get a new **compilation error due to a missing header**, it might be caused by this planned removal: - -**SPIRV Folder, 1-May, 2020.** Glslang, when installed through CMake, -will install a `SPIRV` folder into `${CMAKE_INSTALL_INCLUDEDIR}`. -This `SPIRV` folder is being moved to `glslang/SPIRV`. -During the transition the `SPIRV` folder will be installed into both locations. -The old install of `SPIRV/` will be removed as a CMake install target no sooner than May 1, 2020. -See issue #1964. - -If people are only using this location to get spirv.hpp, I recommend they get that from [SPIRV-Headers](https://github.com/KhronosGroup/SPIRV-Headers) instead. - -[![appveyor status](https://ci.appveyor.com/api/projects/status/q6fi9cb0qnhkla68/branch/master?svg=true)](https://ci.appveyor.com/project/Khronoswebmaster/glslang/branch/master) -![Continuous Deployment](https://github.com/KhronosGroup/glslang/actions/workflows/continuous_deployment.yml/badge.svg) - -# Glslang Components and Status - -There are several components: - -### Reference Validator and GLSL/ESSL -> AST Front End - -An OpenGL GLSL and OpenGL|ES GLSL (ESSL) front-end for reference validation and translation of GLSL/ESSL into an internal abstract syntax tree (AST). - -**Status**: Virtually complete, with results carrying similar weight as the specifications. - -### HLSL -> AST Front End - -An HLSL front-end for translation of an approximation of HLSL to glslang's AST form. - -**Status**: Partially complete. Semantics are not reference quality and input is not validated. -This is in contrast to the [DXC project](https://github.com/Microsoft/DirectXShaderCompiler), which receives a much larger investment and attempts to have definitive/reference-level semantics. - -See [issue 362](https://github.com/KhronosGroup/glslang/issues/362) and [issue 701](https://github.com/KhronosGroup/glslang/issues/701) for current status. - -### AST -> SPIR-V Back End - -Translates glslang's AST to the Khronos-specified SPIR-V intermediate language. - -**Status**: Virtually complete. - -### Reflector - -An API for getting reflection information from the AST, reflection types/variables/etc. from the HLL source (not the SPIR-V). - -**Status**: There is a large amount of functionality present, but no specification/goal to measure completeness against. It is accurate for the input HLL and AST, but only approximate for what would later be emitted for SPIR-V. - -### Standalone Wrapper - -`glslangValidator` is command-line tool for accessing the functionality above. - -Status: Complete. - -Tasks waiting to be done are documented as GitHub issues. - -## Other References - -Also see the Khronos landing page for glslang as a reference front end: - -https://www.khronos.org/opengles/sdk/tools/Reference-Compiler/ - -The above page, while not kept up to date, includes additional information regarding glslang as a reference validator. - -# How to Use Glslang - -## Execution of Standalone Wrapper - -To use the standalone binary form, execute `glslangValidator`, and it will print -a usage statement. Basic operation is to give it a file containing a shader, -and it will print out warnings/errors and optionally an AST. - -The applied stage-specific rules are based on the file extension: -* `.vert` for a vertex shader -* `.tesc` for a tessellation control shader -* `.tese` for a tessellation evaluation shader -* `.geom` for a geometry shader -* `.frag` for a fragment shader -* `.comp` for a compute shader - -There is also a non-shader extension -* `.conf` for a configuration file of limits, see usage statement for example - -## Building (CMake) - -Instead of building manually, you can also download the binaries for your -platform directly from the [master-tot release][master-tot-release] on GitHub. -Those binaries are automatically uploaded by the buildbots after successful -testing and they always reflect the current top of the tree of the master -branch. - -### Dependencies - -* A C++11 compiler. - (For MSVS: use 2015 or later.) -* [CMake][cmake]: for generating compilation targets. -* make: _Linux_, ninja is an alternative, if configured. -* [Python 3.x][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools and the 'External' subdirectory does not exist.) -* [bison][bison]: _optional_, but needed when changing the grammar (glslang.y). -* [googletest][googletest]: _optional_, but should use if making any changes to glslang. - -### Build steps - -The following steps assume a Bash shell. On Windows, that could be the Git Bash -shell or some other shell of your choosing. - -#### 1) Check-Out this project - -```bash -cd -git clone https://github.com/KhronosGroup/glslang.git -``` - -#### 2) Check-Out External Projects - -```bash -cd -git clone https://github.com/google/googletest.git External/googletest -``` - -TEMPORARY NOTICE: additionally perform the following to avoid a current -breakage in googletest: - -```bash -cd External/googletest -git checkout 0c400f67fcf305869c5fb113dd296eca266c9725 -cd ../.. -``` - -If you wish to assure that SPIR-V generated from HLSL is legal for Vulkan, -wish to invoke -Os to reduce SPIR-V size from HLSL or GLSL, or wish to run the -integrated test suite, install spirv-tools with this: - -```bash -./update_glslang_sources.py -``` - -#### 3) Configure - -Assume the source directory is `$SOURCE_DIR` and the build directory is -`$BUILD_DIR`. First ensure the build directory exists, then navigate to it: - -```bash -mkdir -p $BUILD_DIR -cd $BUILD_DIR -``` - -For building on Linux: - -```bash -cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE_DIR -# "Release" (for CMAKE_BUILD_TYPE) could also be "Debug" or "RelWithDebInfo" -``` - -For building on Android: -```bash -cmake $SOURCE_DIR -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DANDROID_STL=c++_static -DANDROID_PLATFORM=android-24 -DCMAKE_SYSTEM_NAME=Android -DANDROID_TOOLCHAIN=clang -DANDROID_ARM_MODE=arm -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK_ROOT/prebuilt/linux-x86_64/bin/make -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake -# If on Windows will be -DCMAKE_MAKE_PROGRAM=%ANDROID_NDK_ROOT%\prebuilt\windows-x86_64\bin\make.exe -# -G is needed for building on Windows -# -DANDROID_ABI can also be armeabi-v7a for 32 bit -``` - -For building on Windows: - -```bash -cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -# The CMAKE_INSTALL_PREFIX part is for testing (explained later). -``` - -The CMake GUI also works for Windows (version 3.4.1 tested). - -Also, consider using `git config --global core.fileMode false` (or with `--local`) on Windows -to prevent the addition of execution permission on files. - -#### 4) Build and Install - -```bash -# for Linux: -make -j4 install - -# for Windows: -cmake --build . --config Release --target install -# "Release" (for --config) could also be "Debug", "MinSizeRel", or "RelWithDebInfo" -``` - -If using MSVC, after running CMake to configure, use the -Configuration Manager to check the `INSTALL` project. - -### Building (GN) - -glslang can also be built with the [GN build system](https://gn.googlesource.com/gn/). - -#### 1) Install `depot_tools` - -Download [depot_tools.zip](https://storage.googleapis.com/chrome-infra/depot_tools.zip), -extract to a directory, and add this directory to your `PATH`. - -#### 2) Synchronize dependencies and generate build files - -This only needs to be done once after updating `glslang`. - -With the current directory set to your `glslang` checkout, type: - -```bash -./update_glslang_sources.py -gclient sync --gclientfile=standalone.gclient -gn gen out/Default -``` - -#### 3) Build - -With the current directory set to your `glslang` checkout, type: - -```bash -cd out/Default -ninja -``` - -### If you need to change the GLSL grammar - -The grammar in `glslang/MachineIndependent/glslang.y` has to be recompiled with -bison if it changes, the output files are committed to the repo to avoid every -developer needing to have bison configured to compile the project when grammar -changes are quite infrequent. For windows you can get binaries from -[GnuWin32][bison-gnu-win32]. - -The command to rebuild is: - -```bash -m4 -P MachineIndependent/glslang.m4 > MachineIndependent/glslang.y -bison --defines=MachineIndependent/glslang_tab.cpp.h - -t MachineIndependent/glslang.y - -o MachineIndependent/glslang_tab.cpp -``` - -The above commands are also available in the bash script in `updateGrammar`, -when executed from the glslang subdirectory of the glslang repository. -With no arguments it builds the full grammar, and with a "web" argument, -the web grammar subset (see more about the web subset in the next section). - -### Building to WASM for the Web and Node -### Building a standalone JS/WASM library for the Web and Node - -Use the steps in [Build Steps](#build-steps), with the following notes/exceptions: -* `emsdk` needs to be present in your executable search path, *PATH* for - Bash-like environments: - + [Instructions located here](https://emscripten.org/docs/getting_started/downloads.html#sdk-download-and-install) -* Wrap cmake call: `emcmake cmake` -* Set `-DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF`. -* Set `-DENABLE_HLSL=OFF` if HLSL is not needed. -* For a standalone JS/WASM library, turn on `-DENABLE_GLSLANG_JS=ON`. -* For building a minimum-size web subset of core glslang: - + turn on `-DENABLE_GLSLANG_WEBMIN=ON` (disables HLSL) - + execute `updateGrammar web` from the glslang subdirectory - (or if using your own scripts, `m4` needs a `-DGLSLANG_WEB` argument) - + optionally, for GLSL compilation error messages, turn on - `-DENABLE_GLSLANG_WEBMIN_DEVEL=ON` -* To get a fully minimized build, make sure to use `brotli` to compress the .js - and .wasm files - -Example: - -```sh -emcmake cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GLSLANG_JS=ON \ - -DENABLE_HLSL=OFF -DBUILD_TESTING=OFF -DENABLE_OPT=OFF -DINSTALL_GTEST=OFF .. -``` - -## Building glslang - Using vcpkg - -You can download and install glslang using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: - - git clone https://github.com/Microsoft/vcpkg.git - cd vcpkg - ./bootstrap-vcpkg.sh - ./vcpkg integrate install - ./vcpkg install glslang - -The glslang port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. - -## Testing - -Right now, there are two test harnesses existing in glslang: one is [Google -Test](gtests/), one is the [`runtests` script](Test/runtests). The former -runs unit tests and single-shader single-threaded integration tests, while -the latter runs multiple-shader linking tests and multi-threaded tests. - -### Running tests - -The [`runtests` script](Test/runtests) requires compiled binaries to be -installed into `$BUILD_DIR/install`. Please make sure you have supplied the -correct configuration to CMake (using `-DCMAKE_INSTALL_PREFIX`) when building; -otherwise, you may want to modify the path in the `runtests` script. - -Running Google Test-backed tests: - -```bash -cd $BUILD_DIR - -# for Linux: -ctest - -# for Windows: -ctest -C {Debug|Release|RelWithDebInfo|MinSizeRel} - -# or, run the test binary directly -# (which gives more fine-grained control like filtering): -/glslangtests -``` - -Running `runtests` script-backed tests: - -```bash -cd $SOURCE_DIR/Test && ./runtests -``` - -If some tests fail with validation errors, there may be a mismatch between the -version of `spirv-val` on the system and the version of glslang. In this -case, it is necessary to run `update_glslang_sources.py`. See "Check-Out -External Projects" above for more details. - -### Contributing tests - -Test results should always be included with a pull request that modifies -functionality. - -If you are writing unit tests, please use the Google Test framework and -place the tests under the `gtests/` directory. - -Integration tests are placed in the `Test/` directory. It contains test input -and a subdirectory `baseResults/` that contains the expected results of the -tests. Both the tests and `baseResults/` are under source-code control. - -Google Test runs those integration tests by reading the test input, compiling -them, and then compare against the expected results in `baseResults/`. The -integration tests to run via Google Test is registered in various -`gtests/*.FromFile.cpp` source files. `glslangtests` provides a command-line -option `--update-mode`, which, if supplied, will overwrite the golden files -under the `baseResults/` directory with real output from that invocation. -For more information, please check `gtests/` directory's -[README](gtests/README.md). - -For the `runtests` script, it will generate current results in the -`localResults/` directory and `diff` them against the `baseResults/`. -When you want to update the tracked test results, they need to be -copied from `localResults/` to `baseResults/`. This can be done by -the `bump` shell script. - -You can add your own private list of tests, not tracked publicly, by using -`localtestlist` to list non-tracked tests. This is automatically read -by `runtests` and included in the `diff` and `bump` process. - -## Programmatic Interfaces - -Another piece of software can programmatically translate shaders to an AST -using one of two different interfaces: -* A new C++ class-oriented interface, or -* The original C functional interface - -The `main()` in `StandAlone/StandAlone.cpp` shows examples using both styles. - -### C++ Class Interface (new, preferred) - -This interface is in roughly the last 1/3 of `ShaderLang.h`. It is in the -glslang namespace and contains the following, here with suggested calls -for generating SPIR-V: - -```cxx -const char* GetEsslVersionString(); -const char* GetGlslVersionString(); -bool InitializeProcess(); -void FinalizeProcess(); - -class TShader - setStrings(...); - setEnvInput(EShSourceHlsl or EShSourceGlsl, stage, EShClientVulkan or EShClientOpenGL, 100); - setEnvClient(EShClientVulkan or EShClientOpenGL, EShTargetVulkan_1_0 or EShTargetVulkan_1_1 or EShTargetOpenGL_450); - setEnvTarget(EShTargetSpv, EShTargetSpv_1_0 or EShTargetSpv_1_3); - bool parse(...); - const char* getInfoLog(); - -class TProgram - void addShader(...); - bool link(...); - const char* getInfoLog(); - Reflection queries -``` - -For just validating (not generating code), substitute these calls: - -```cxx - setEnvInput(EShSourceHlsl or EShSourceGlsl, stage, EShClientNone, 0); - setEnvClient(EShClientNone, 0); - setEnvTarget(EShTargetNone, 0); -``` - -See `ShaderLang.h` and the usage of it in `StandAlone/StandAlone.cpp` for more -details. There is a block comment giving more detail above the calls for -`setEnvInput, setEnvClient, and setEnvTarget`. - -### C Functional Interface (original) - -This interface is in roughly the first 2/3 of `ShaderLang.h`, and referred to -as the `Sh*()` interface, as all the entry points start `Sh`. - -The `Sh*()` interface takes a "compiler" call-back object, which it calls after -building call back that is passed the AST and can then execute a back end on it. - -The following is a simplified resulting run-time call stack: - -```c -ShCompile(shader, compiler) -> compiler(AST) -> -``` - -In practice, `ShCompile()` takes shader strings, default version, and -warning/error and other options for controlling compilation. - -## Basic Internal Operation - -* Initial lexical analysis is done by the preprocessor in - `MachineIndependent/Preprocessor`, and then refined by a GLSL scanner - in `MachineIndependent/Scan.cpp`. There is currently no use of flex. - -* Code is parsed using bison on `MachineIndependent/glslang.y` with the - aid of a symbol table and an AST. The symbol table is not passed on to - the back-end; the intermediate representation stands on its own. - The tree is built by the grammar productions, many of which are - offloaded into `ParseHelper.cpp`, and by `Intermediate.cpp`. - -* The intermediate representation is very high-level, and represented - as an in-memory tree. This serves to lose no information from the - original program, and to have efficient transfer of the result from - parsing to the back-end. In the AST, constants are propagated and - folded, and a very small amount of dead code is eliminated. - - To aid linking and reflection, the last top-level branch in the AST - lists all global symbols. - -* The primary algorithm of the back-end compiler is to traverse the - tree (high-level intermediate representation), and create an internal - object code representation. There is an example of how to do this - in `MachineIndependent/intermOut.cpp`. - -* Reduction of the tree to a linear byte-code style low-level intermediate - representation is likely a good way to generate fully optimized code. - -* There is currently some dead old-style linker-type code still lying around. - -* Memory pool: parsing uses types derived from C++ `std` types, using a - custom allocator that puts them in a memory pool. This makes allocation - of individual container/contents just few cycles and deallocation free. - This pool is popped after the AST is made and processed. - - The use is simple: if you are going to call `new`, there are three cases: - - - the object comes from the pool (its base class has the macro - `POOL_ALLOCATOR_NEW_DELETE` in it) and you do not have to call `delete` - - - it is a `TString`, in which case call `NewPoolTString()`, which gets - it from the pool, and there is no corresponding `delete` - - - the object does not come from the pool, and you have to do normal - C++ memory management of what you `new` - -* Features can be protected by version/extension/stage/profile: - See the comment in `glslang/MachineIndependent/Versions.cpp`. - -[cmake]: https://cmake.org/ -[python]: https://www.python.org/ -[bison]: https://www.gnu.org/software/bison/ -[googletest]: https://github.com/google/googletest -[bison-gnu-win32]: http://gnuwin32.sourceforge.net/packages/bison.htm -[master-tot-release]: https://github.com/KhronosGroup/glslang/releases/tag/master-tot diff --git a/lib/shaderc/third_party/glslang/SPIRV/CInterface/spirv_c_interface.cpp b/lib/shaderc/third_party/glslang/SPIRV/CInterface/spirv_c_interface.cpp deleted file mode 100644 index a0790f48f..000000000 --- a/lib/shaderc/third_party/glslang/SPIRV/CInterface/spirv_c_interface.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/** - This code is based on the glslang_c_interface implementation by Viktor Latypov -**/ - -/** -BSD 2-Clause License - -Copyright (c) 2019, Viktor Latypov -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -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 HOLDER 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 "glslang/Include/glslang_c_interface.h" - -#include "SPIRV/GlslangToSpv.h" -#include "SPIRV/Logger.h" -#include "SPIRV/SpvTools.h" - -typedef struct glslang_program_s { - glslang::TProgram* program; - std::vector spirv; - std::string loggerMessages; -} glslang_program_t; - -static EShLanguage c_shader_stage(glslang_stage_t stage) -{ - switch (stage) { - case GLSLANG_STAGE_VERTEX: - return EShLangVertex; - case GLSLANG_STAGE_TESSCONTROL: - return EShLangTessControl; - case GLSLANG_STAGE_TESSEVALUATION: - return EShLangTessEvaluation; - case GLSLANG_STAGE_GEOMETRY: - return EShLangGeometry; - case GLSLANG_STAGE_FRAGMENT: - return EShLangFragment; - case GLSLANG_STAGE_COMPUTE: - return EShLangCompute; - case GLSLANG_STAGE_RAYGEN_NV: - return EShLangRayGen; - case GLSLANG_STAGE_INTERSECT_NV: - return EShLangIntersect; - case GLSLANG_STAGE_ANYHIT_NV: - return EShLangAnyHit; - case GLSLANG_STAGE_CLOSESTHIT_NV: - return EShLangClosestHit; - case GLSLANG_STAGE_MISS_NV: - return EShLangMiss; - case GLSLANG_STAGE_CALLABLE_NV: - return EShLangCallable; - case GLSLANG_STAGE_TASK_NV: - return EShLangTaskNV; - case GLSLANG_STAGE_MESH_NV: - return EShLangMeshNV; - default: - break; - } - return EShLangCount; -} - -GLSLANG_EXPORT void glslang_program_SPIRV_generate(glslang_program_t* program, glslang_stage_t stage) -{ - spv::SpvBuildLogger logger; - glslang::SpvOptions spvOptions; - spvOptions.validate = true; - - const glslang::TIntermediate* intermediate = program->program->getIntermediate(c_shader_stage(stage)); - - glslang::GlslangToSpv(*intermediate, program->spirv, &logger, &spvOptions); - - program->loggerMessages = logger.getAllMessages(); -} - -GLSLANG_EXPORT size_t glslang_program_SPIRV_get_size(glslang_program_t* program) { return program->spirv.size(); } - -GLSLANG_EXPORT void glslang_program_SPIRV_get(glslang_program_t* program, unsigned int* out) -{ - memcpy(out, program->spirv.data(), program->spirv.size() * sizeof(unsigned int)); -} - -GLSLANG_EXPORT unsigned int* glslang_program_SPIRV_get_ptr(glslang_program_t* program) -{ - return program->spirv.data(); -} - -GLSLANG_EXPORT const char* glslang_program_SPIRV_get_messages(glslang_program_t* program) -{ - return program->loggerMessages.empty() ? nullptr : program->loggerMessages.c_str(); -} diff --git a/lib/shaderc/third_party/glslang/SPIRV/CMakeLists.txt b/lib/shaderc/third_party/glslang/SPIRV/CMakeLists.txt deleted file mode 100644 index 22f767d7d..000000000 --- a/lib/shaderc/third_party/glslang/SPIRV/CMakeLists.txt +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright (C) 2020 The Khronos Group Inc. -# -# 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 The Khronos Group 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. - -set(SOURCES - GlslangToSpv.cpp - InReadableOrder.cpp - Logger.cpp - SpvBuilder.cpp - SpvPostProcess.cpp - doc.cpp - SpvTools.cpp - disassemble.cpp - CInterface/spirv_c_interface.cpp) - -set(SPVREMAP_SOURCES - SPVRemapper.cpp - doc.cpp) - -set(HEADERS - bitutils.h - spirv.hpp - GLSL.std.450.h - GLSL.ext.EXT.h - GLSL.ext.KHR.h - GlslangToSpv.h - hex_float.h - Logger.h - SpvBuilder.h - spvIR.h - doc.h - SpvTools.h - disassemble.h - GLSL.ext.AMD.h - GLSL.ext.NV.h - NonSemanticDebugPrintf.h) - -set(SPVREMAP_HEADERS - SPVRemapper.h - doc.h) - -add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS}) -set_property(TARGET SPIRV PROPERTY FOLDER glslang) -set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON) -target_include_directories(SPIRV PUBLIC - $ - $) - -glslang_add_build_info_dependency(SPIRV) - -if (ENABLE_SPVREMAPPER) - add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) - set_property(TARGET SPVRemapper PROPERTY FOLDER glslang) - set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON) -endif() - -if(WIN32 AND BUILD_SHARED_LIBS) - set_target_properties(SPIRV PROPERTIES PREFIX "") - if (ENABLE_SPVREMAPPER) - set_target_properties(SPVRemapper PROPERTIES PREFIX "") - endif() -endif() - -if(ENABLE_OPT) - target_include_directories(SPIRV - PRIVATE ${spirv-tools_SOURCE_DIR}/include - PRIVATE ${spirv-tools_SOURCE_DIR}/source - ) - target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt) - target_include_directories(SPIRV PUBLIC - $ - $) -else() - target_link_libraries(SPIRV PRIVATE MachineIndependent) -endif() - -if(WIN32) - source_group("Source" FILES ${SOURCES} ${HEADERS}) - source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) -endif() - -if(ENABLE_GLSLANG_INSTALL) - if(BUILD_SHARED_LIBS) - if (ENABLE_SPVREMAPPER) - install(TARGETS SPVRemapper EXPORT SPVRemapperTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - install(TARGETS SPIRV EXPORT SPIRVTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - else() - if (ENABLE_SPVREMAPPER) - install(TARGETS SPVRemapper EXPORT SPVRemapperTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - install(TARGETS SPIRV EXPORT SPIRVTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - if (ENABLE_SPVREMAPPER) - install(EXPORT SPVRemapperTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) - endif() - - install(EXPORT SPIRVTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) - - install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/) -endif() diff --git a/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.AMD.h b/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.AMD.h deleted file mode 100644 index 009d2f1cf..000000000 --- a/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.AMD.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -** Copyright (c) 2014-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextAMD_H -#define GLSLextAMD_H - -static const int GLSLextAMDVersion = 100; -static const int GLSLextAMDRevision = 7; - -// SPV_AMD_shader_ballot -static const char* const E_SPV_AMD_shader_ballot = "SPV_AMD_shader_ballot"; - -enum ShaderBallotAMD { - ShaderBallotBadAMD = 0, // Don't use - - SwizzleInvocationsAMD = 1, - SwizzleInvocationsMaskedAMD = 2, - WriteInvocationAMD = 3, - MbcntAMD = 4, - - ShaderBallotCountAMD -}; - -// SPV_AMD_shader_trinary_minmax -static const char* const E_SPV_AMD_shader_trinary_minmax = "SPV_AMD_shader_trinary_minmax"; - -enum ShaderTrinaryMinMaxAMD { - ShaderTrinaryMinMaxBadAMD = 0, // Don't use - - FMin3AMD = 1, - UMin3AMD = 2, - SMin3AMD = 3, - FMax3AMD = 4, - UMax3AMD = 5, - SMax3AMD = 6, - FMid3AMD = 7, - UMid3AMD = 8, - SMid3AMD = 9, - - ShaderTrinaryMinMaxCountAMD -}; - -// SPV_AMD_shader_explicit_vertex_parameter -static const char* const E_SPV_AMD_shader_explicit_vertex_parameter = "SPV_AMD_shader_explicit_vertex_parameter"; - -enum ShaderExplicitVertexParameterAMD { - ShaderExplicitVertexParameterBadAMD = 0, // Don't use - - InterpolateAtVertexAMD = 1, - - ShaderExplicitVertexParameterCountAMD -}; - -// SPV_AMD_gcn_shader -static const char* const E_SPV_AMD_gcn_shader = "SPV_AMD_gcn_shader"; - -enum GcnShaderAMD { - GcnShaderBadAMD = 0, // Don't use - - CubeFaceIndexAMD = 1, - CubeFaceCoordAMD = 2, - TimeAMD = 3, - - GcnShaderCountAMD -}; - -// SPV_AMD_gpu_shader_half_float -static const char* const E_SPV_AMD_gpu_shader_half_float = "SPV_AMD_gpu_shader_half_float"; - -// SPV_AMD_texture_gather_bias_lod -static const char* const E_SPV_AMD_texture_gather_bias_lod = "SPV_AMD_texture_gather_bias_lod"; - -// SPV_AMD_gpu_shader_int16 -static const char* const E_SPV_AMD_gpu_shader_int16 = "SPV_AMD_gpu_shader_int16"; - -// SPV_AMD_shader_image_load_store_lod -static const char* const E_SPV_AMD_shader_image_load_store_lod = "SPV_AMD_shader_image_load_store_lod"; - -// SPV_AMD_shader_fragment_mask -static const char* const E_SPV_AMD_shader_fragment_mask = "SPV_AMD_shader_fragment_mask"; - -// SPV_AMD_gpu_shader_half_float_fetch -static const char* const E_SPV_AMD_gpu_shader_half_float_fetch = "SPV_AMD_gpu_shader_half_float_fetch"; - -#endif // #ifndef GLSLextAMD_H diff --git a/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.EXT.h b/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.EXT.h deleted file mode 100644 index f48f1304d..000000000 --- a/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.EXT.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -** Copyright (c) 2014-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextEXT_H -#define GLSLextEXT_H - -static const int GLSLextEXTVersion = 100; -static const int GLSLextEXTRevision = 2; - -static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export"; -static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer"; -static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered"; -static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density"; -static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation"; -static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_atomic_float_add"; -static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add"; -static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max"; -static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64"; - -#endif // #ifndef GLSLextEXT_H diff --git a/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.KHR.h b/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.KHR.h deleted file mode 100644 index 5eb3e9448..000000000 --- a/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.KHR.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -** Copyright (c) 2014-2020 The Khronos Group Inc. -** Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextKHR_H -#define GLSLextKHR_H - -static const int GLSLextKHRVersion = 100; -static const int GLSLextKHRRevision = 2; - -static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot"; -static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote"; -static const char* const E_SPV_KHR_device_group = "SPV_KHR_device_group"; -static const char* const E_SPV_KHR_multiview = "SPV_KHR_multiview"; -static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters"; -static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage"; -static const char* const E_SPV_KHR_8bit_storage = "SPV_KHR_8bit_storage"; -static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class"; -static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage"; -static const char* const E_SPV_KHR_vulkan_memory_model = "SPV_KHR_vulkan_memory_model"; -static const char* const E_SPV_EXT_physical_storage_buffer = "SPV_EXT_physical_storage_buffer"; -static const char* const E_SPV_KHR_physical_storage_buffer = "SPV_KHR_physical_storage_buffer"; -static const char* const E_SPV_EXT_fragment_shader_interlock = "SPV_EXT_fragment_shader_interlock"; -static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shader_clock"; -static const char* const E_SPV_KHR_non_semantic_info = "SPV_KHR_non_semantic_info"; -static const char* const E_SPV_KHR_ray_tracing = "SPV_KHR_ray_tracing"; -static const char* const E_SPV_KHR_ray_query = "SPV_KHR_ray_query"; -static const char* const E_SPV_KHR_fragment_shading_rate = "SPV_KHR_fragment_shading_rate"; -static const char* const E_SPV_KHR_terminate_invocation = "SPV_KHR_terminate_invocation"; -static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_workgroup_memory_explicit_layout"; -static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow"; - -#endif // #ifndef GLSLextKHR_H diff --git a/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.NV.h b/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.NV.h deleted file mode 100644 index 93c98bf62..000000000 --- a/lib/shaderc/third_party/glslang/SPIRV/GLSL.ext.NV.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -** Copyright (c) 2014-2017 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLextNV_H -#define GLSLextNV_H - -enum BuiltIn; -enum Decoration; -enum Op; -enum Capability; - -static const int GLSLextNVVersion = 100; -static const int GLSLextNVRevision = 11; - -//SPV_NV_sample_mask_override_coverage -const char* const E_SPV_NV_sample_mask_override_coverage = "SPV_NV_sample_mask_override_coverage"; - -//SPV_NV_geometry_shader_passthrough -const char* const E_SPV_NV_geometry_shader_passthrough = "SPV_NV_geometry_shader_passthrough"; - -//SPV_NV_viewport_array2 -const char* const E_SPV_NV_viewport_array2 = "SPV_NV_viewport_array2"; -const char* const E_ARB_shader_viewport_layer_array = "SPV_ARB_shader_viewport_layer_array"; - -//SPV_NV_stereo_view_rendering -const char* const E_SPV_NV_stereo_view_rendering = "SPV_NV_stereo_view_rendering"; - -//SPV_NVX_multiview_per_view_attributes -const char* const E_SPV_NVX_multiview_per_view_attributes = "SPV_NVX_multiview_per_view_attributes"; - -//SPV_NV_shader_subgroup_partitioned -const char* const E_SPV_NV_shader_subgroup_partitioned = "SPV_NV_shader_subgroup_partitioned"; - -//SPV_NV_fragment_shader_barycentric -const char* const E_SPV_NV_fragment_shader_barycentric = "SPV_NV_fragment_shader_barycentric"; - -//SPV_NV_compute_shader_derivatives -const char* const E_SPV_NV_compute_shader_derivatives = "SPV_NV_compute_shader_derivatives"; - -//SPV_NV_shader_image_footprint -const char* const E_SPV_NV_shader_image_footprint = "SPV_NV_shader_image_footprint"; - -//SPV_NV_mesh_shader -const char* const E_SPV_NV_mesh_shader = "SPV_NV_mesh_shader"; - -//SPV_NV_raytracing -const char* const E_SPV_NV_ray_tracing = "SPV_NV_ray_tracing"; - -//SPV_NV_ray_tracing_motion_blur -const char* const E_SPV_NV_ray_tracing_motion_blur = "SPV_NV_ray_tracing_motion_blur"; - -//SPV_NV_shading_rate -const char* const E_SPV_NV_shading_rate = "SPV_NV_shading_rate"; - -//SPV_NV_cooperative_matrix -const char* const E_SPV_NV_cooperative_matrix = "SPV_NV_cooperative_matrix"; - -//SPV_NV_shader_sm_builtins -const char* const E_SPV_NV_shader_sm_builtins = "SPV_NV_shader_sm_builtins"; - -#endif // #ifndef GLSLextNV_H diff --git a/lib/shaderc/third_party/glslang/SPIRV/GLSL.std.450.h b/lib/shaderc/third_party/glslang/SPIRV/GLSL.std.450.h deleted file mode 100644 index df31092be..000000000 --- a/lib/shaderc/third_party/glslang/SPIRV/GLSL.std.450.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -** Copyright (c) 2014-2016 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and/or associated documentation files (the "Materials"), -** to deal in the Materials without restriction, including without limitation -** the rights to use, copy, modify, merge, publish, distribute, sublicense, -** and/or sell copies of the Materials, and to permit persons to whom the -** Materials are furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Materials. -** -** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS -** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND -** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS -** IN THE MATERIALS. -*/ - -#ifndef GLSLstd450_H -#define GLSLstd450_H - -static const int GLSLstd450Version = 100; -static const int GLSLstd450Revision = 1; - -enum GLSLstd450 { - GLSLstd450Bad = 0, // Don't use - - GLSLstd450Round = 1, - GLSLstd450RoundEven = 2, - GLSLstd450Trunc = 3, - GLSLstd450FAbs = 4, - GLSLstd450SAbs = 5, - GLSLstd450FSign = 6, - GLSLstd450SSign = 7, - GLSLstd450Floor = 8, - GLSLstd450Ceil = 9, - GLSLstd450Fract = 10, - - GLSLstd450Radians = 11, - GLSLstd450Degrees = 12, - GLSLstd450Sin = 13, - GLSLstd450Cos = 14, - GLSLstd450Tan = 15, - GLSLstd450Asin = 16, - GLSLstd450Acos = 17, - GLSLstd450Atan = 18, - GLSLstd450Sinh = 19, - GLSLstd450Cosh = 20, - GLSLstd450Tanh = 21, - GLSLstd450Asinh = 22, - GLSLstd450Acosh = 23, - GLSLstd450Atanh = 24, - GLSLstd450Atan2 = 25, - - GLSLstd450Pow = 26, - GLSLstd450Exp = 27, - GLSLstd450Log = 28, - GLSLstd450Exp2 = 29, - GLSLstd450Log2 = 30, - GLSLstd450Sqrt = 31, - GLSLstd450InverseSqrt = 32, - - GLSLstd450Determinant = 33, - GLSLstd450MatrixInverse = 34, - - GLSLstd450Modf = 35, // second operand needs an OpVariable to write to - GLSLstd450ModfStruct = 36, // no OpVariable operand - GLSLstd450FMin = 37, - GLSLstd450UMin = 38, - GLSLstd450SMin = 39, - GLSLstd450FMax = 40, - GLSLstd450UMax = 41, - GLSLstd450SMax = 42, - GLSLstd450FClamp = 43, - GLSLstd450UClamp = 44, - GLSLstd450SClamp = 45, - GLSLstd450FMix = 46, - GLSLstd450IMix = 47, // Reserved - GLSLstd450Step = 48, - GLSLstd450SmoothStep = 49, - - GLSLstd450Fma = 50, - GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to - GLSLstd450FrexpStruct = 52, // no OpVariable operand - GLSLstd450Ldexp = 53, - - GLSLstd450PackSnorm4x8 = 54, - GLSLstd450PackUnorm4x8 = 55, - GLSLstd450PackSnorm2x16 = 56, - GLSLstd450PackUnorm2x16 = 57, - GLSLstd450PackHalf2x16 = 58, - GLSLstd450PackDouble2x32 = 59, - GLSLstd450UnpackSnorm2x16 = 60, - GLSLstd450UnpackUnorm2x16 = 61, - GLSLstd450UnpackHalf2x16 = 62, - GLSLstd450UnpackSnorm4x8 = 63, - GLSLstd450UnpackUnorm4x8 = 64, - GLSLstd450UnpackDouble2x32 = 65, - - GLSLstd450Length = 66, - GLSLstd450Distance = 67, - GLSLstd450Cross = 68, - GLSLstd450Normalize = 69, - GLSLstd450FaceForward = 70, - GLSLstd450Reflect = 71, - GLSLstd450Refract = 72, - - GLSLstd450FindILsb = 73, - GLSLstd450FindSMsb = 74, - GLSLstd450FindUMsb = 75, - - GLSLstd450InterpolateAtCentroid = 76, - GLSLstd450InterpolateAtSample = 77, - GLSLstd450InterpolateAtOffset = 78, - - GLSLstd450NMin = 79, - GLSLstd450NMax = 80, - GLSLstd450NClamp = 81, - - GLSLstd450Count -}; - -#endif // #ifndef GLSLstd450_H diff --git a/lib/shaderc/third_party/glslang/SPIRV/GlslangToSpv.cpp b/lib/shaderc/third_party/glslang/SPIRV/GlslangToSpv.cpp deleted file mode 100644 index 39941d375..000000000 --- a/lib/shaderc/third_party/glslang/SPIRV/GlslangToSpv.cpp +++ /dev/null @@ -1,9453 +0,0 @@ -// -// Copyright (C) 2014-2016 LunarG, Inc. -// Copyright (C) 2015-2020 Google, Inc. -// Copyright (C) 2017 ARM Limited. -// Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved. -// -// 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 3Dlabs Inc. Ltd. 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 T