diff options
4 files changed, 211 insertions, 0 deletions
diff --git a/meta/recipes-graphics/shaderc/files/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch b/meta/recipes-graphics/shaderc/files/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch new file mode 100644 index 0000000000..1ca84a29bb --- /dev/null +++ b/meta/recipes-graphics/shaderc/files/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From 53f1f5c714df1f0a2eb57c1ce00bc66fc9a1690e Mon Sep 17 00:00:00 2001 | ||
2 | From: Niklas Haas <git@haasn.xyz> | ||
3 | Date: Tue, 29 May 2018 07:34:00 +0200 | ||
4 | Subject: [PATCH 1/3] Fix the link order of libglslang and libHLSL | ||
5 | |||
6 | libglslang depends on libHLSL, so the latter needs to be specified last. | ||
7 | This fixes an issue when trying to build shaderc against system-wide | ||
8 | versions of libglslang/libHLSL, rather than the in-tree versions from | ||
9 | third_party. | ||
10 | |||
11 | Additionally, libshaderc_util also depends on SPIRV-Tools | ||
12 | |||
13 | Upstream-Status: Backport [21c8be385b3fab5edcb934a6d99f69fd389c4e67] | ||
14 | |||
15 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
16 | --- | ||
17 | glslc/CMakeLists.txt | 2 +- | ||
18 | libshaderc_util/CMakeLists.txt | 4 ++-- | ||
19 | 2 files changed, 3 insertions(+), 3 deletions(-) | ||
20 | |||
21 | diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt | ||
22 | index acf6fb0..0f5d888 100644 | ||
23 | --- a/glslc/CMakeLists.txt | ||
24 | +++ b/glslc/CMakeLists.txt | ||
25 | @@ -18,7 +18,7 @@ add_library(glslc STATIC | ||
26 | shaderc_default_compile_options(glslc) | ||
27 | target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR}) | ||
28 | target_link_libraries(glslc PRIVATE glslang OSDependent OGLCompiler | ||
29 | - HLSL glslang SPIRV ${CMAKE_THREAD_LIBS_INIT}) | ||
30 | + glslang SPIRV HLSL ${CMAKE_THREAD_LIBS_INIT}) | ||
31 | target_link_libraries(glslc PRIVATE shaderc_util shaderc) | ||
32 | |||
33 | add_executable(glslc_exe src/main.cc) | ||
34 | diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt | ||
35 | index ec0e8fb..ded089d 100644 | ||
36 | --- a/libshaderc_util/CMakeLists.txt | ||
37 | +++ b/libshaderc_util/CMakeLists.txt | ||
38 | @@ -28,8 +28,8 @@ target_include_directories(shaderc_util | ||
39 | |||
40 | find_package(Threads) | ||
41 | target_link_libraries(shaderc_util PRIVATE | ||
42 | - glslang OSDependent OGLCompiler HLSL glslang SPIRV | ||
43 | - SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) | ||
44 | + glslang OSDependent OGLCompiler glslang HLSL SPIRV | ||
45 | + SPIRV-Tools-opt SPIRV-Tools ${CMAKE_THREAD_LIBS_INIT}) | ||
46 | |||
47 | shaderc_add_tests( | ||
48 | TEST_PREFIX shaderc_util | ||
49 | -- | ||
50 | 2.28.0 | ||
51 | |||
diff --git a/meta/recipes-graphics/shaderc/files/0002-shaderc-2019.0-fix-build-against-new-glslang.patch b/meta/recipes-graphics/shaderc/files/0002-shaderc-2019.0-fix-build-against-new-glslang.patch new file mode 100644 index 0000000000..b31b88de48 --- /dev/null +++ b/meta/recipes-graphics/shaderc/files/0002-shaderc-2019.0-fix-build-against-new-glslang.patch | |||
@@ -0,0 +1,73 @@ | |||
1 | From 44e99802fa16bb5b53b5e80c2c84f305802d494d Mon Sep 17 00:00:00 2001 | ||
2 | From: Jose Quaresma <quaresma.jose@gmail.com> | ||
3 | Date: Tue, 13 Oct 2020 15:20:11 +0100 | ||
4 | Subject: [PATCH 2/3] shaderc-2019.0: fix build against new glslang | ||
5 | |||
6 | posted to the arch package repository by: svenstaro@gmail.com | ||
7 | https://github.com/archlinux/svntogit-packages/commit/72283b634a0bd7c8d99cc605e273fe1294b77b44 | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
12 | --- | ||
13 | libshaderc/src/shaderc.cc | 2 +- | ||
14 | libshaderc_util/src/compiler.cc | 10 +--------- | ||
15 | 2 files changed, 2 insertions(+), 10 deletions(-) | ||
16 | |||
17 | diff --git a/libshaderc/src/shaderc.cc b/libshaderc/src/shaderc.cc | ||
18 | index 3c3c3de..b5fc6cb 100644 | ||
19 | --- a/libshaderc/src/shaderc.cc | ||
20 | +++ b/libshaderc/src/shaderc.cc | ||
21 | @@ -20,7 +20,7 @@ | ||
22 | #include <sstream> | ||
23 | #include <vector> | ||
24 | |||
25 | -#include "SPIRV/spirv.hpp" | ||
26 | +#include "glslang/SPIRV/spirv.hpp" | ||
27 | |||
28 | #include "libshaderc_util/compiler.h" | ||
29 | #include "libshaderc_util/counting_includer.h" | ||
30 | diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc | ||
31 | index ef7867f..acc172b 100644 | ||
32 | --- a/libshaderc_util/src/compiler.cc | ||
33 | +++ b/libshaderc_util/src/compiler.cc | ||
34 | @@ -26,7 +26,7 @@ | ||
35 | #include "libshaderc_util/string_piece.h" | ||
36 | #include "libshaderc_util/version_profile.h" | ||
37 | |||
38 | -#include "SPIRV/GlslangToSpv.h" | ||
39 | +#include "glslang/SPIRV/GlslangToSpv.h" | ||
40 | |||
41 | namespace { | ||
42 | using shaderc_util::string_piece; | ||
43 | @@ -291,17 +291,12 @@ std::tuple<bool, std::vector<uint32_t>, size_t> Compiler::Compile( | ||
44 | bases[static_cast<int>(UniformKind::StorageBuffer)]); | ||
45 | shader.setShiftUavBinding( | ||
46 | bases[static_cast<int>(UniformKind::UnorderedAccessView)]); | ||
47 | - shader.setHlslIoMapping(hlsl_iomap_); | ||
48 | shader.setResourceSetBinding( | ||
49 | hlsl_explicit_bindings_[static_cast<int>(used_shader_stage)]); | ||
50 | shader.setEnvClient(target_client_info.client, | ||
51 | target_client_info.client_version); | ||
52 | shader.setEnvTarget(target_client_info.target_language, | ||
53 | target_client_info.target_language_version); | ||
54 | - if (hlsl_functionality1_enabled_) { | ||
55 | - shader.setEnvTargetHlslFunctionality1(); | ||
56 | - } | ||
57 | - | ||
58 | const EShMessages rules = GetMessageRules(target_env_, source_language_, | ||
59 | hlsl_offsets_, | ||
60 | generate_debug_info_); | ||
61 | @@ -478,9 +473,6 @@ std::tuple<bool, std::string, std::string> Compiler::PreprocessShader( | ||
62 | } | ||
63 | shader.setEnvClient(target_client_info.client, | ||
64 | target_client_info.client_version); | ||
65 | - if (hlsl_functionality1_enabled_) { | ||
66 | - shader.setEnvTargetHlslFunctionality1(); | ||
67 | - } | ||
68 | |||
69 | // The preprocessor might be sensitive to the target environment. | ||
70 | // So combine the existing rules with the just-give-me-preprocessor-output | ||
71 | -- | ||
72 | 2.28.0 | ||
73 | |||
diff --git a/meta/recipes-graphics/shaderc/files/0003-cmake-de-vendor-libs-and-disable-git-versioning.patch b/meta/recipes-graphics/shaderc/files/0003-cmake-de-vendor-libs-and-disable-git-versioning.patch new file mode 100644 index 0000000000..0d58925adc --- /dev/null +++ b/meta/recipes-graphics/shaderc/files/0003-cmake-de-vendor-libs-and-disable-git-versioning.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From e092619a9ef7910ad56acfb8728c66f0125d176a Mon Sep 17 00:00:00 2001 | ||
2 | From: Jose Quaresma <quaresma.jose@gmail.com> | ||
3 | Date: Sat, 17 Oct 2020 12:51:50 +0100 | ||
4 | Subject: [PATCH 3/3] cmake: de-vendor libs and disable git versioning | ||
5 | |||
6 | Upstream-Status: Inappropriate [configuration] | ||
7 | |||
8 | Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> | ||
9 | --- | ||
10 | CMakeLists.txt | 2 -- | ||
11 | glslc/CMakeLists.txt | 1 - | ||
12 | glslc/src/build-version.inc | 0 | ||
13 | 3 files changed, 3 deletions(-) | ||
14 | create mode 100644 glslc/src/build-version.inc | ||
15 | |||
16 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
17 | index a4e779b..cfa7bd8 100644 | ||
18 | --- a/CMakeLists.txt | ||
19 | +++ b/CMakeLists.txt | ||
20 | @@ -70,7 +70,6 @@ endif(MSVC) | ||
21 | |||
22 | # Configure subdirectories. | ||
23 | # We depend on these for later projects, so they should come first. | ||
24 | -add_subdirectory(third_party) | ||
25 | |||
26 | if(SHADERC_ENABLE_SPVC) | ||
27 | add_subdirectory(libshaderc_spvc) | ||
28 | @@ -79,7 +78,6 @@ endif() | ||
29 | add_subdirectory(libshaderc_util) | ||
30 | add_subdirectory(libshaderc) | ||
31 | add_subdirectory(glslc) | ||
32 | -add_subdirectory(examples) | ||
33 | |||
34 | add_custom_target(build-version | ||
35 | ${PYTHON_EXECUTABLE} | ||
36 | diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt | ||
37 | index 0f5d888..08686e0 100644 | ||
38 | --- a/glslc/CMakeLists.txt | ||
39 | +++ b/glslc/CMakeLists.txt | ||
40 | @@ -26,7 +26,6 @@ shaderc_default_compile_options(glslc_exe) | ||
41 | target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include) | ||
42 | set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc) | ||
43 | target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc) | ||
44 | -add_dependencies(glslc_exe build-version) | ||
45 | |||
46 | shaderc_add_tests( | ||
47 | TEST_PREFIX glslc | ||
48 | diff --git a/glslc/src/build-version.inc b/glslc/src/build-version.inc | ||
49 | new file mode 100644 | ||
50 | index 0000000..e69de29 | ||
51 | -- | ||
52 | 2.28.0 | ||
53 | |||
diff --git a/meta/recipes-graphics/shaderc/shaderc_2019.0.bb b/meta/recipes-graphics/shaderc/shaderc_2019.0.bb new file mode 100644 index 0000000000..3bd9c61a55 --- /dev/null +++ b/meta/recipes-graphics/shaderc/shaderc_2019.0.bb | |||
@@ -0,0 +1,34 @@ | |||
1 | SUMMARY = "A collection of tools, libraries and tests for shader compilation" | ||
2 | DESCRIPTION = "The Shaderc library provides an API for compiling GLSL/HLSL \ | ||
3 | source code to SPIRV modules. It has been shipping in the Android NDK since version r12b." | ||
4 | SECTION = "graphics" | ||
5 | HOMEPAGE = "https://github.com/google/shaderc" | ||
6 | LICENSE = "Apache-2.0" | ||
7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" | ||
8 | |||
9 | SRCREV = "34c412f21f945f4ef6ed4453f8b5dc4bb9d739e4" | ||
10 | SRC_URI = "git://github.com/google/shaderc.git;protocol=https;branch=main \ | ||
11 | file://0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch \ | ||
12 | file://0002-shaderc-2019.0-fix-build-against-new-glslang.patch \ | ||
13 | file://0003-cmake-de-vendor-libs-and-disable-git-versioning.patch \ | ||
14 | " | ||
15 | S = "${WORKDIR}/git" | ||
16 | |||
17 | inherit cmake python3native | ||
18 | |||
19 | DEPENDS = "spirv-tools glslang" | ||
20 | |||
21 | EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DSHADERC_SKIP_TESTS=ON" | ||
22 | |||
23 | do_configure_prepend() { | ||
24 | # TODO: probably there is better solution for this. | ||
25 | # I dont know any method for get the version of a receipe in DEPENDS | ||
26 | # so do this ugly hack | ||
27 | cat <<- EOF > ${S}/glslc/src/build-version.inc | ||
28 | "${PV}\\n" | ||
29 | "$(pkg-config --modversion SPIRV-Tools)\\n" | ||
30 | "$(glslangValidator --version | head -1 | cut -d' ' -f3)\\n" | ||
31 | EOF | ||
32 | } | ||
33 | |||
34 | BBCLASSEXTEND = "native nativesdk" | ||