summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/shaderc/files
diff options
context:
space:
mode:
authorJose Quaresma <quaresma.jose@gmail.com>2020-10-26 11:39:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-30 13:22:48 +0000
commit54ed922f7ff024e25cd5736b6498d419f892f635 (patch)
tree82330a04530e1619a79ea82d86953a331b46a9bd /meta/recipes-graphics/shaderc/files
parent3449463beda17c0bd7690f7449b1729699c7349c (diff)
downloadpoky-54ed922f7ff024e25cd5736b6498d419f892f635.tar.gz
shaderc: add receipe
A collection of tools, libraries and tests for shader compilation This receipe is needed to build the gstreamer vulkan plugin as it provides the binary glslc. It is based on arch linux shaderc packge including the patches https://github.com/archlinux/svntogit-packages/blob/91f0fa6ee3a220264a448527c1a8cf037caaad8e/trunk/PKGBUILD * 0001-fix-glslang-link-order.patch Upstream-Status: Backport [21c8be385b3fab5edcb934a6d99f69fd389c4e67] * 0002-shaderc-2019.0-fix-build-against-new-glslang.patch Upstream-Status: Pending * 0003-cmake-de-vendor-libs-and-disable-git-versioning.patch Upstream-Status: Inappropriate [configuration] (From OE-Core rev: 2947b0385e342886cbc712cd551f854a5cbbdb1f) Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/shaderc/files')
-rw-r--r--meta/recipes-graphics/shaderc/files/0001-Fix-the-link-order-of-libglslang-and-libHLSL.patch51
-rw-r--r--meta/recipes-graphics/shaderc/files/0002-shaderc-2019.0-fix-build-against-new-glslang.patch73
-rw-r--r--meta/recipes-graphics/shaderc/files/0003-cmake-de-vendor-libs-and-disable-git-versioning.patch53
3 files changed, 177 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 @@
1From 53f1f5c714df1f0a2eb57c1ce00bc66fc9a1690e Mon Sep 17 00:00:00 2001
2From: Niklas Haas <git@haasn.xyz>
3Date: Tue, 29 May 2018 07:34:00 +0200
4Subject: [PATCH 1/3] Fix the link order of libglslang and libHLSL
5
6libglslang depends on libHLSL, so the latter needs to be specified last.
7This fixes an issue when trying to build shaderc against system-wide
8versions of libglslang/libHLSL, rather than the in-tree versions from
9third_party.
10
11Additionally, libshaderc_util also depends on SPIRV-Tools
12
13Upstream-Status: Backport [21c8be385b3fab5edcb934a6d99f69fd389c4e67]
14
15Signed-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
21diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt
22index 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)
34diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt
35index 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--
502.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 @@
1From 44e99802fa16bb5b53b5e80c2c84f305802d494d Mon Sep 17 00:00:00 2001
2From: Jose Quaresma <quaresma.jose@gmail.com>
3Date: Tue, 13 Oct 2020 15:20:11 +0100
4Subject: [PATCH 2/3] shaderc-2019.0: fix build against new glslang
5
6posted to the arch package repository by: svenstaro@gmail.com
7https://github.com/archlinux/svntogit-packages/commit/72283b634a0bd7c8d99cc605e273fe1294b77b44
8
9Upstream-Status: Pending
10
11Signed-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
17diff --git a/libshaderc/src/shaderc.cc b/libshaderc/src/shaderc.cc
18index 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"
30diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc
31index 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--
722.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 @@
1From e092619a9ef7910ad56acfb8728c66f0125d176a Mon Sep 17 00:00:00 2001
2From: Jose Quaresma <quaresma.jose@gmail.com>
3Date: Sat, 17 Oct 2020 12:51:50 +0100
4Subject: [PATCH 3/3] cmake: de-vendor libs and disable git versioning
5
6Upstream-Status: Inappropriate [configuration]
7
8Signed-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
16diff --git a/CMakeLists.txt b/CMakeLists.txt
17index 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}
36diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt
37index 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
48diff --git a/glslc/src/build-version.inc b/glslc/src/build-version.inc
49new file mode 100644
50index 0000000..e69de29
51--
522.28.0
53