Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package shaderc for openSUSE:Factory checked in at 2024-12-26 12:23:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/shaderc (Old) and /work/SRC/openSUSE:Factory/.shaderc.new.1881 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "shaderc" Thu Dec 26 12:23:20 2024 rev:31 rq:1233214 version:2024.4 Changes: -------- --- /work/SRC/openSUSE:Factory/shaderc/shaderc.changes 2024-10-09 22:03:24.422336208 +0200 +++ /work/SRC/openSUSE:Factory/.shaderc.new.1881/shaderc.changes 2024-12-26 12:23:28.773497755 +0100 @@ -1,0 +2,6 @@ +Tue Dec 24 02:37:17 UTC 2024 - Jan Engelhardt <[email protected]> + +- Update to release 2024.4 + * Vulkan 1.4 support + +------------------------------------------------------------------- Old: ---- v2024.3.tar.gz New: ---- v2024.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ shaderc.spec ++++++ --- /var/tmp/diff_new_pack.aBIke7/_old 2024-12-26 12:23:29.493527256 +0100 +++ /var/tmp/diff_new_pack.aBIke7/_new 2024-12-26 12:23:29.497527420 +0100 @@ -19,7 +19,7 @@ # Remember to bump in baselibs.conf %define lname libshaderc_shared1 Name: shaderc -Version: 2024.3 +Version: 2024.4 Release: 0 Summary: A collection of tools, libraries and tests for shader compilation License: Apache-2.0 @@ -31,11 +31,11 @@ Patch1: 0001-Use-system-third-party-libs.patch BuildRequires: c++_compiler BuildRequires: cmake >= 2.8.12 -BuildRequires: glslang-devel >= 15 +BuildRequires: glslang-devel >= 15.1 BuildRequires: glslang-nonstd-devel BuildRequires: python3-base -BuildRequires: spirv-headers >= 1.6.4+sdk296 -BuildRequires: spirv-tools-devel >= 2024.4~rc1 +BuildRequires: spirv-headers >= 1.6.4+sdk303 +BuildRequires: spirv-tools-devel >= 2024.4~rc2 %description A collection of tools, libraries and tests for shader compilation. ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.aBIke7/_old 2024-12-26 12:23:29.533528895 +0100 +++ /var/tmp/diff_new_pack.aBIke7/_new 2024-12-26 12:23:29.537529059 +0100 @@ -1,5 +1,5 @@ -mtime: 1728405193 -commit: aa5a5524d17a867ab545f9c4c4e176749afe4b6ee8b9196c0f51acc018b52ae7 +mtime: 1735007995 +commit: 6586e89e4f3f1afa01909390a875423418af67dbe95cda059b18c4bcac18176d url: https://src.opensuse.org/jengelh/shaderc revision: master ++++++ build.specials.obscpio ++++++ diff: old/*: No such file or directory diff: new/*: No such file or directory ++++++ v2024.3.tar.gz -> v2024.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/CHANGES new/shaderc-2024.4/CHANGES --- old/shaderc-2024.3/CHANGES 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/CHANGES 2024-12-07 18:03:30.000000000 +0100 @@ -1,5 +1,8 @@ Revision history for Shaderc +v2024.4 + - Support Vulkan 1.4 + v2024.3 - Update dependencies: Glslang, SPRIV-Tools, SPIRV-Headers - SPIRV-Tools is at v2024.4.rc1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/DEPS new/shaderc-2024.4/DEPS --- old/shaderc-2024.3/DEPS 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/DEPS 2024-12-07 18:03:30.000000000 +0100 @@ -7,11 +7,11 @@ 'abseil_revision': '1315c900e1ddbb08a23e06eeb9a06450052ccb5e', 'effcee_revision': 'd74d33d93043952a99ae7cd7458baf6bc8df1da0', - 'glslang_revision': '467ce01c71e38cf01814c48987a5c0dadd914df4', + 'glslang_revision': 'a0995c49ebcaca2c6d3b03efbabf74f3843decdb', 'googletest_revision': '1d17ea141d2c11b8917d2c7d029f1c4e2b9769b2', 're2_revision': '4a8cee3dd3c3d81b6fe8b867811e193d5819df07', - 'spirv_headers_revision': '2a9b6f951c7d6b04b6c21fe1bf3f475b68b84801', - 'spirv_tools_revision': '01c8438ee4ac52c248119b7e03e0b021f853b51a', + 'spirv_headers_revision': '3f17b2af6784bfa2c5aa5dbb8e0e74a607dd8b3b', + 'spirv_tools_revision': '4d2f0b40bfe290dea6c6904dafdf7fd8328ba346', } deps = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/glslc/README.asciidoc new/shaderc-2024.4/glslc/README.asciidoc --- old/shaderc-2024.3/glslc/README.asciidoc 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/glslc/README.asciidoc 2024-12-07 18:03:30.000000000 +0100 @@ -234,6 +234,8 @@ * `vulkan1.0`: create SPIR-V under Vulkan 1.0 semantics. * `vulkan1.1`: create SPIR-V under Vulkan 1.1 semantics. * `vulkan1.2`: create SPIR-V under Vulkan 1.2 semantics. +* `vulkan1.3`: create SPIR-V under Vulkan 1.3 semantics. +* `vulkan1.4`: create SPIR-V under Vulkan 1.4 semantics. * `opengl`: create SPIR-V under OpenGL 4.5 semantics. * `opengl4.5`: create SPIR-V under OpenGL 4.5 semantics. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/glslc/src/main.cc new/shaderc-2024.4/glslc/src/main.cc --- old/shaderc-2024.3/glslc/src/main.cc 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/glslc/src/main.cc 2024-12-07 18:03:30.000000000 +0100 @@ -165,6 +165,7 @@ vulkan1.1 vulkan1.2 vulkan1.3 + vulkan1.4 vulkan # Same as vulkan1.0 opengl4.5 opengl # Same as opengl4.5 @@ -174,8 +175,9 @@ required to be supported for the target environment. For example, default for vulkan1.0 is spv1.0, and the default for vulkan1.1 is spv1.3, - the default for vulkan1.2 is spv1.5. - the default for vulkan1.3 is spv1.6. + the default for vulkan1.2 is spv1.5, + the default for vulkan1.3 is spv1.6, + the default for vulkan1.4 is spv1.6. Values are: spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5, spv1.6 --version Display compiler version information. @@ -265,8 +267,9 @@ // Sets binding base for the given uniform kind. If stage is // shader_glsl_infer_from_source then set it for all shader stages. - auto set_binding_base = [&compiler]( - shaderc_shader_kind stage, shaderc_uniform_kind kind, uint32_t base) { + auto set_binding_base = [&compiler](shaderc_shader_kind stage, + shaderc_uniform_kind kind, + uint32_t base) { if (stage == shaderc_glsl_infer_from_source) compiler.options().SetBindingBase(kind, base); else @@ -452,6 +455,9 @@ } else if (target_env_str == "vulkan1.3") { target_env = shaderc_target_env_vulkan; version = shaderc_env_version_vulkan_1_3; + } else if (target_env_str == "vulkan1.4") { + target_env = shaderc_target_env_vulkan; + version = shaderc_env_version_vulkan_1_4; } else if (target_env_str == "opengl") { target_env = shaderc_target_env_opengl; } else if (target_env_str == "opengl4.5") { @@ -675,9 +681,10 @@ // from the file name. If current_fshader_stage is specifed to one of // the forced shader kinds, use that for the following compilation. input_files.emplace_back(glslc::InputFileSpec{ - arg.str(), (current_fshader_stage == shaderc_glsl_infer_from_source - ? glslc::DeduceDefaultShaderKindFromFileName(arg) - : current_fshader_stage), + arg.str(), + (current_fshader_stage == shaderc_glsl_infer_from_source + ? glslc::DeduceDefaultShaderKindFromFileName(arg) + : current_fshader_stage), language, current_entry_point_name}); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/glslc/test/option_target_env.py new/shaderc-2024.4/glslc/test/option_target_env.py --- old/shaderc-2024.3/glslc/test/option_target_env.py 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/glslc/test/option_target_env.py 2024-12-07 18:03:30.000000000 +0100 @@ -131,16 +131,27 @@ glslc_args = ['--target-env=vulkan1.2', '-c', shader] @inside_glslc_testsuite('OptionTargetEnv') -class TestTargetEnvEqVulkan1_2WithVulkan1_0ShaderSucceeds(expect.ValidObjectFile1_6): +class TestTargetEnvEqVulkan1_3WithVulkan1_0ShaderSucceeds(expect.ValidObjectFile1_6): shader = FileShader(vulkan_vertex_shader(), '.vert') glslc_args = ['--target-env=vulkan1.3', '-c', shader] @inside_glslc_testsuite('OptionTargetEnv') -class TestTargetEnvEqVulkan1_2WithVulkan1_1ShaderSucceeds(expect.ValidObjectFile1_6): +class TestTargetEnvEqVulkan1_3WithVulkan1_1ShaderSucceeds(expect.ValidObjectFile1_6): shader = FileShader(vulkan_compute_subgroup_shader(), '.comp') glslc_args = ['--target-env=vulkan1.3', '-c', shader] @inside_glslc_testsuite('OptionTargetEnv') +class TestTargetEnvEqVulkan1_4WithVulkan1_0ShaderSucceeds(expect.ValidObjectFile1_6): + shader = FileShader(vulkan_vertex_shader(), '.vert') + glslc_args = ['--target-env=vulkan1.4', '-c', shader] + +@inside_glslc_testsuite('OptionTargetEnv') +class TestTargetEnvEqVulkan1_4WithVulkan1_1ShaderSucceeds(expect.ValidObjectFile1_6): + shader = FileShader(vulkan_compute_subgroup_shader(), '.comp') + glslc_args = ['--target-env=vulkan1.4', '-c', shader] + + +@inside_glslc_testsuite('OptionTargetEnv') class TestTargetEnvEqOpenGL4_5WithOpenGLShaderSucceeds(expect.ValidObjectFile): shader = FileShader(opengl_vertex_shader(), '.vert') glslc_args = ['--target-env=opengl4.5', '-c', shader] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/glslc/test/parameter_tests.py new/shaderc-2024.4/glslc/test/parameter_tests.py --- old/shaderc-2024.3/glslc/test/parameter_tests.py 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/glslc/test/parameter_tests.py 2024-12-07 18:03:30.000000000 +0100 @@ -169,6 +169,7 @@ vulkan1.1 vulkan1.2 vulkan1.3 + vulkan1.4 vulkan # Same as vulkan1.0 opengl4.5 opengl # Same as opengl4.5 @@ -178,8 +179,9 @@ required to be supported for the target environment. For example, default for vulkan1.0 is spv1.0, and the default for vulkan1.1 is spv1.3, - the default for vulkan1.2 is spv1.5. - the default for vulkan1.3 is spv1.6. + the default for vulkan1.2 is spv1.5, + the default for vulkan1.3 is spv1.6, + the default for vulkan1.4 is spv1.6. Values are: spv1.0, spv1.1, spv1.2, spv1.3, spv1.4, spv1.5, spv1.6 --version Display compiler version information. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/libshaderc/include/shaderc/env.h new/shaderc-2024.4/libshaderc/include/shaderc/env.h --- old/shaderc-2024.3/libshaderc/include/shaderc/env.h 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/libshaderc/include/shaderc/env.h 2024-12-07 18:03:30.000000000 +0100 @@ -41,6 +41,7 @@ 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)), + shaderc_env_version_vulkan_1_4 = ((1u << 22) | (4 << 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/libshaderc/src/shaderc.cc new/shaderc-2024.4/libshaderc/src/shaderc.cc --- old/shaderc-2024.3/libshaderc/src/shaderc.cc 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/libshaderc/src/shaderc.cc 2024-12-07 18:03:30.000000000 +0100 @@ -110,7 +110,7 @@ public: explicit StageDeducer( shaderc_shader_kind kind = shaderc_glsl_infer_from_source) - : kind_(kind), error_(false){} + : 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 @@ -203,9 +203,9 @@ void* user_data) : resolver_(resolver), result_releaser_(result_releaser), - user_data_(user_data){} + user_data_(user_data) {} InternalFileIncluder() - : resolver_(nullptr), result_releaser_(nullptr), user_data_(nullptr){} + : resolver_(nullptr), result_releaser_(nullptr), user_data_(nullptr) {} private: // Check the validity of the callbacks. @@ -311,6 +311,10 @@ version_number) { return Compiler::TargetEnvVersion::Vulkan_1_3; } + if (static_cast<uint32_t>(Compiler::TargetEnvVersion::Vulkan_1_4) == + version_number) { + return Compiler::TargetEnvVersion::Vulkan_1_4; + } if (static_cast<uint32_t>(Compiler::TargetEnvVersion::OpenGL_4_5) == version_number) { return Compiler::TargetEnvVersion::OpenGL_4_5; @@ -569,8 +573,8 @@ options->compiler.SetVulkanRulesRelaxed(enable); } -void shaderc_compile_options_set_invert_y( - shaderc_compile_options_t options, bool enable) { +void shaderc_compile_options_set_invert_y(shaderc_compile_options_t options, + bool enable) { options->compiler.EnableInvertY(enable); } @@ -587,9 +591,7 @@ return compiler; } -void shaderc_compiler_release(shaderc_compiler_t compiler) { - delete compiler; -} +void shaderc_compiler_release(shaderc_compiler_t compiler) { delete compiler; } namespace { shaderc_compilation_result_t CompileToSpecifiedOutputType( @@ -629,7 +631,8 @@ 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, + 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. @@ -641,9 +644,9 @@ 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); + 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(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/libshaderc/src/shaderc_cpp_test.cc new/shaderc-2024.4/libshaderc/src/shaderc_cpp_test.cc --- old/shaderc-2024.3/libshaderc/src/shaderc_cpp_test.cc 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/libshaderc/src/shaderc_cpp_test.cc 2024-12-07 18:03:30.000000000 +0100 @@ -103,12 +103,12 @@ // 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) { + 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' @@ -458,9 +458,8 @@ TEST_F(CppInterface, GenerateDebugInfoBinary) { options_.SetGenerateDebugInfo(); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, options_); + 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"); @@ -472,9 +471,8 @@ TEST_F(CppInterface, GenerateDebugInfoBinaryClonedOptions) { options_.SetGenerateDebugInfo(); CompileOptions cloned_options(options_); - const std::string binary_output = - CompilationOutput(kMinimalDebugInfoShader, - shaderc_glsl_vertex_shader, cloned_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"); @@ -846,39 +844,39 @@ } INSTANTIATE_TEST_SUITE_P(CppInterface, IncluderTests, - testing::ValuesIn(std::vector<IncluderTestCase>{ - 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"), + testing::ValuesIn(std::vector<IncluderTestCase>{ + 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 @@ -1077,6 +1075,7 @@ shaderc_glsl_compute_shader, options_)); } +// Simple Vulkan 1.1 tests TEST_F(CppInterface, TargetEnvCompileOptionsVulkan1_1EnvVulkan1_0ShaderSucceeds) { options_.SetTargetEnvironment(shaderc_target_env_vulkan, @@ -1093,6 +1092,59 @@ shaderc_glsl_compute_shader, options_)); } +// Simple Vulkan 1.2 tests +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_2EnvVulkan1_0ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_2); + EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_2EnvVulkan1_1ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_2); + EXPECT_TRUE(CompilationSuccess(SubgroupBarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +// Simple Vulkan 1.3 tests +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_3EnvVulkan1_0ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_3); + EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_3EnvVulkan1_1ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_3); + EXPECT_TRUE(CompilationSuccess(SubgroupBarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +// Simple Vulkan 1.4 tests +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_4EnvVulkan1_0ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_4); + EXPECT_TRUE(CompilationSuccess(BarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +TEST_F(CppInterface, + TargetEnvCompileOptionsVulkan1_4EnvVulkan1_1ShaderSucceeds) { + options_.SetTargetEnvironment(shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_4); + EXPECT_TRUE(CompilationSuccess(SubgroupBarrierComputeShader(), + shaderc_glsl_compute_shader, options_)); +} + +// Other tests + TEST_F(CppInterface, BeginAndEndOnSpvCompilationResult) { const SpvCompilationResult compilation_result = compiler_.CompileGlslToSpv( kMinimalShader, shaderc_glsl_vertex_shader, "shader"); @@ -1432,8 +1484,9 @@ // 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); + const std::string disassembly_text = + AssemblyOutput(kHlslShaderWithCounterBuffer, shaderc_glsl_fragment_shader, + cloned_options); EXPECT_THAT(disassembly_text, HasSubstr("OpDecorateString")); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/libshaderc/src/shaderc_test.cc new/shaderc-2024.4/libshaderc/src/shaderc_test.cc --- old/shaderc-2024.3/libshaderc/src/shaderc_test.cc 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/libshaderc/src/shaderc_test.cc 2024-12-07 18:03:30.000000000 +0100 @@ -609,9 +609,8 @@ 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()); + 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"); @@ -626,8 +625,8 @@ 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()); + 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"); @@ -984,39 +983,39 @@ } INSTANTIATE_TEST_SUITE_P(CompileStringTest, IncluderTests, - testing::ValuesIn(std::vector<IncluderTestCase>{ - 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"), + testing::ValuesIn(std::vector<IncluderTestCase>{ + 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 @@ -1224,6 +1223,63 @@ EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, shaderc_glsl_compute_shader, options_.get())); } + +// Simple Vulkan 1.2 tests +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_0ShaderToVulkan1_2Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_2); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_1ShaderToVulkan1_2Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_2); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +// Simple Vulkan 1.3 tests +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_0ShaderToVulkan1_3Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_3); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_1ShaderToVulkan1_3Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_3); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +// Simple Vulkan 1.4 tests +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_0ShaderToVulkan1_4Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_4); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeBarrier, + shaderc_glsl_compute_shader, options_.get())); +} + +TEST_F(CompileStringWithOptionsTest, + TargetEnvRespectedWhenCompilingVulkan1_1ShaderToVulkan1_4Succeeds) { + shaderc_compile_options_set_target_env(options_.get(), + shaderc_target_env_vulkan, + shaderc_env_version_vulkan_1_4); + EXPECT_TRUE(CompilesToValidSpv(compiler_, kGlslShaderComputeSubgroupBarrier, + shaderc_glsl_compute_shader, options_.get())); +} // task shader TEST_F(CompileStringWithOptionsTest, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/libshaderc_util/include/libshaderc_util/compiler.h new/shaderc-2024.4/libshaderc_util/include/libshaderc_util/compiler.h --- old/shaderc-2024.3/libshaderc_util/include/libshaderc_util/compiler.h 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/libshaderc_util/include/libshaderc_util/compiler.h 2024-12-07 18:03:30.000000000 +0100 @@ -24,10 +24,9 @@ #include <unordered_map> #include <utility> -#include "glslang/Public/ShaderLang.h" - #include "counting_includer.h" #include "file_finder.h" +#include "glslang/Public/ShaderLang.h" #include "mutex.h" #include "resources.h" #include "string_piece.h" @@ -85,7 +84,8 @@ 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 + Vulkan_1_3 = ((1 << 22) | (3 << 12)), // Vulkan 1.3 + Vulkan_1_4 = ((1 << 22) | (4 << 12)), // Vulkan 1.4 // For OpenGL, use the numbering from #version in shaders. OpenGL_4_5 = 450, }; @@ -297,8 +297,8 @@ } // 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. + // 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); @@ -343,8 +343,8 @@ // 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. + // (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) { @@ -393,7 +393,8 @@ const string_piece& error_tag)>& stage_callback, CountingIncluder& includer, OutputType output_type, - std::ostream* error_stream, size_t* total_warnings, size_t* total_errors) const; + std::ostream* error_stream, size_t* total_warnings, + size_t* total_errors) const; static EShMessages GetDefaultRules() { return static_cast<EShMessages>(EShMsgSpvRules | EShMsgVulkanRules | @@ -521,9 +522,9 @@ // 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. + // 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 @@ -544,7 +545,8 @@ // source language is HLSL. bool hlsl_legalization_enabled_; - // True if the compiler should support extension SPV_GOOGLE_hlsl_functionality1. + // True if the compiler should support extension + // SPV_GOOGLE_hlsl_functionality1. bool hlsl_functionality1_enabled_; // True if the compiler should support 16-bit HLSL types. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/libshaderc_util/src/compiler.cc new/shaderc-2024.4/libshaderc_util/src/compiler.cc --- old/shaderc-2024.3/libshaderc_util/src/compiler.cc 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/libshaderc_util/src/compiler.cc 2024-12-07 18:03:30.000000000 +0100 @@ -178,7 +178,8 @@ const string_piece& error_tag)>& stage_callback, CountingIncluder& includer, OutputType output_type, - std::ostream* error_stream, size_t* total_warnings, size_t* total_errors) const { + 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. @@ -192,8 +193,8 @@ // Check target environment. const auto target_client_info = GetGlslangClientInfo( - error_tag, target_env_, target_env_version_, - target_spirv_version_, target_spirv_version_is_forced_); + 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; @@ -272,7 +273,8 @@ shader.setEntryPoint(entry_point_name); shader.setAutoMapBindings(auto_bind_uniforms_); if (auto_combined_image_sampler_) { - shader.setTextureSamplerTransformMode(EShTexSampTransUpgradeTextureRemoveSampler); + shader.setTextureSamplerTransformMode( + EShTexSampTransUpgradeTextureRemoveSampler); } shader.setAutoMapLocations(auto_map_locations_); const auto& bases = auto_binding_base_[static_cast<int>(used_shader_stage)]; @@ -296,7 +298,7 @@ } if (vulkan_rules_relaxed_) { glslang::EShSource language = glslang::EShSourceNone; - switch(source_language_) { + switch (source_language_) { case SourceLanguage::GLSL: language = glslang::EShSourceGlsl; break; @@ -307,7 +309,8 @@ // This option will only be used if the Vulkan client is used. // If new versions of GL_KHR_vulkan_glsl come out, it would make sense to // let callers specify which version to use. For now, just use 100. - shader.setEnvInput(language, used_shader_stage, glslang::EShClientVulkan, 100); + shader.setEnvInput(language, used_shader_stage, glslang::EShClientVulkan, + 100); shader.setEnvInputVulkanRulesRelaxed(); } shader.setInvertY(invert_y_enabled_); @@ -494,8 +497,8 @@ &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_); + 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); } @@ -755,6 +758,9 @@ } 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 if (env_version == Compiler::TargetEnvVersion::Vulkan_1_4) { + result.client_version = glslang::EShTargetVulkan_1_4; + result.target_language_version = glslang::EShTargetSpv_1_6; } else { errs << "error:" << error_tag << ": Invalid target client version " << static_cast<uint32_t>(env_version) << " for Vulkan environment " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/libshaderc_util/src/compiler_test.cc new/shaderc-2024.4/libshaderc_util/src/compiler_test.cc --- old/shaderc-2024.3/libshaderc_util/src/compiler_test.cc 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/libshaderc_util/src/compiler_test.cc 2024-12-07 18:03:30.000000000 +0100 @@ -14,10 +14,10 @@ #include "libshaderc_util/compiler.h" -#include <sstream> - #include <gmock/gmock.h> +#include <sstream> + #include "death_test.h" #include "libshaderc_util/counting_includer.h" #include "libshaderc_util/spirv_tools_wrapper.h" @@ -353,16 +353,18 @@ compiler_.SetTargetEnv(Compiler::TargetEnv::Vulkan, static_cast<Compiler::TargetEnvVersion>(123)); EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, - HasSubstr("Invalid target client version 123 for Vulkan environment 0")); + EXPECT_THAT( + errors_, + HasSubstr("Invalid target client version 123 for Vulkan environment 0")); } TEST_F(CompilerTest, BadTargetEnvOpenGLVersionFails) { compiler_.SetTargetEnv(Compiler::TargetEnv::OpenGL, static_cast<Compiler::TargetEnvVersion>(123)); EXPECT_FALSE(SimpleCompilationSucceeds(kVulkanVertexShader, EShLangVertex)); - EXPECT_THAT(errors_, - HasSubstr("Invalid target client version 123 for OpenGL environment 1")); + EXPECT_THAT( + errors_, + HasSubstr("Invalid target client version 123 for OpenGL environment 1")); } TEST_F(CompilerTest, SpirvTargetVersion1_0Succeeds) { @@ -535,18 +537,17 @@ #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<SetLimitCase>{ - // clang-format off +INSTANTIATE_TEST_SUITE_P(CompilerTest, LimitTest, + // See resources.cc for the defaults. + testing::ValuesIn(std::vector<SetLimitCase>{ + // 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 - })); + // clang-format on + })); #undef CASE // Returns a fragment shader accessing a texture with the given @@ -819,9 +820,8 @@ EXPECT_THAT(disassembly, HasSubstr("OpExtension \"SPV_GOOGLE_hlsl_functionality1\"")) << disassembly; - EXPECT_THAT(disassembly, - HasSubstr("OpDecorateString %_entryPointOutput " - "UserSemantic \"SV_TARGET0\"")) + EXPECT_THAT(disassembly, HasSubstr("OpDecorateString %_entryPointOutput " + "UserSemantic \"SV_TARGET0\"")) << disassembly; } @@ -926,6 +926,8 @@ // 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_VK(1_3, 1_6), false, GCASE_VK("", 1_3, 1_6)}, + {CASE_VK(1_4, 1_6), false, GCASE_VK("", 1_4, 1_6)}, {CASE_GL(4_5, 1_4), false, GCASE_GL("", 450, 1_0)}, })); @@ -941,6 +943,12 @@ {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_VK(1_3, 1_4), true, GCASE_VK("", 1_3, 1_4)}, + {CASE_VK(1_3, 1_5), true, GCASE_VK("", 1_3, 1_5)}, + {CASE_VK(1_3, 1_6), true, GCASE_VK("", 1_3, 1_6)}, + {CASE_VK(1_4, 1_4), true, GCASE_VK("", 1_4, 1_4)}, + {CASE_VK(1_4, 1_5), true, GCASE_VK("", 1_4, 1_5)}, + {CASE_VK(1_4, 1_6), true, GCASE_VK("", 1_4, 1_6)}, {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)}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/shaderc-2024.3/libshaderc_util/src/spirv_tools_wrapper.cc new/shaderc-2024.4/libshaderc_util/src/spirv_tools_wrapper.cc --- old/shaderc-2024.3/libshaderc_util/src/spirv_tools_wrapper.cc 2024-09-23 23:32:56.000000000 +0200 +++ new/shaderc-2024.4/libshaderc_util/src/spirv_tools_wrapper.cc 2024-12-07 18:03:30.000000000 +0100 @@ -40,6 +40,8 @@ return SPV_ENV_VULKAN_1_2; case Compiler::TargetEnvVersion::Vulkan_1_3: return SPV_ENV_VULKAN_1_3; + case Compiler::TargetEnvVersion::Vulkan_1_4: + return SPV_ENV_VULKAN_1_4; default: break; }
