From 02d4351238d87a23dd24e492eab9aaeb5399fd3393274e6c4ce4607bdef247aa Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Tue, 19 Nov 2019 09:03:29 +0000 Subject: [PATCH] - Add 0001-Force-Glslang-to-support-HLSL-in-its-interface-784.patch OBS-URL: https://build.opensuse.org/package/show/X11:Wayland/shaderc?expand=0&rev=6 --- ...to-support-HLSL-in-its-interface-784.patch | 92 +++++++++++++++++++ shaderc.changes | 5 + shaderc.spec | 5 +- 3 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 0001-Force-Glslang-to-support-HLSL-in-its-interface-784.patch diff --git a/0001-Force-Glslang-to-support-HLSL-in-its-interface-784.patch b/0001-Force-Glslang-to-support-HLSL-in-its-interface-784.patch new file mode 100644 index 0000000..4f0fae4 --- /dev/null +++ b/0001-Force-Glslang-to-support-HLSL-in-its-interface-784.patch @@ -0,0 +1,92 @@ +From ec4ea59c6d523ee563611651e6a15b1c31ffcd2e Mon Sep 17 00:00:00 2001 +From: David Neto +Date: Wed, 21 Aug 2019 21:33:34 -0400 +Subject: [PATCH] Force Glslang to support HLSL in its interface (#784) + +Fixes a compilation problem introduced by recent +Glslang changes to optionally build into a very small +GLSL-only binary. + +Also fix test cases to have set and binding layout qualifiers on +buffers when compiling for Vulkan. This rule is now enforced by +Glslang. +--- + README.md | 8 ++++++++ + glslc/test/option_dash_fhlsl_offsets.py | 1 + + libshaderc/src/common_shaders_for_test.h | 1 + + libshaderc_util/CMakeLists.txt | 3 +++ + libshaderc_util/src/compiler_test.cc | 1 + + 5 files changed, 14 insertions(+) + +diff --git a/README.md b/README.md +index e2c3355..172c8e0 100644 +--- a/README.md ++++ b/README.md +@@ -93,6 +93,14 @@ Shaderc into. + + 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 +diff --git a/glslc/test/option_dash_fhlsl_offsets.py b/glslc/test/option_dash_fhlsl_offsets.py +index 631a275..4682d31 100644 +--- a/glslc/test/option_dash_fhlsl_offsets.py ++++ b/glslc/test/option_dash_fhlsl_offsets.py +@@ -19,6 +19,7 @@ from placeholder import FileShader + + # A GLSL shader with uniforms without explicit bindings. + GLSL_SHADER = """#version 450 ++ layout(set=0, binding=0) + buffer B { float x; vec3 y; } my_ssbo; + void main() { + my_ssbo.x = 1.0; +diff --git a/libshaderc/src/common_shaders_for_test.h b/libshaderc/src/common_shaders_for_test.h +index 512742a..c87ed76 100644 +--- a/libshaderc/src/common_shaders_for_test.h ++++ b/libshaderc/src/common_shaders_for_test.h +@@ -293,6 +293,7 @@ const char kShaderWithUniformsWithoutBindings[] = + // 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; })"; + +diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt +index 85e100c..f8ae95d 100644 +--- a/libshaderc_util/CMakeLists.txt ++++ b/libshaderc_util/CMakeLists.txt +@@ -26,6 +26,9 @@ add_library(shaderc_util STATIC + 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 +diff --git a/libshaderc_util/src/compiler_test.cc b/libshaderc_util/src/compiler_test.cc +index 1a0b21c..f6207e6 100644 +--- a/libshaderc_util/src/compiler_test.cc ++++ b/libshaderc_util/src/compiler_test.cc +@@ -119,6 +119,7 @@ const char kGlslVertShaderNoExplicitLocation[] = + // 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; })"; + +-- +2.24.0 + diff --git a/shaderc.changes b/shaderc.changes index 3e17627..984cbfe 100644 --- a/shaderc.changes +++ b/shaderc.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Nov 19 09:02:32 UTC 2019 - Jan Engelhardt + +- Add 0001-Force-Glslang-to-support-HLSL-in-its-interface-784.patch + ------------------------------------------------------------------- Wed Jun 5 11:59:17 UTC 2019 - Jan Engelhardt diff --git a/shaderc.spec b/shaderc.spec index 3a4985b..1d746ef 100644 --- a/shaderc.spec +++ b/shaderc.spec @@ -1,7 +1,7 @@ # # spec file for package shaderc # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LLC. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -23,9 +23,10 @@ Release: 0 Summary: A collection of tools, libraries and tests for shader compilation License: Apache-2.0 Group: Development/Tools/Other -Url: https://github.com/google/shaderc +URL: https://github.com/google/shaderc Source: %name-%version.tar.xz Patch1: 0001-Use-system-third-party-libs.patch +Patch2: 0001-Force-Glslang-to-support-HLSL-in-its-interface-784.patch BuildRequires: c++_compiler BuildRequires: cmake BuildRequires: glslang-devel >= 7