mirror of https://github.com/PCSX2/pcsx2.git
271 lines
9.8 KiB
Diff
271 lines
9.8 KiB
Diff
diff --git a/CHANGES b/CHANGES
|
|
index 5d3dd16..587b612 100644
|
|
--- a/CHANGES
|
|
+++ b/CHANGES
|
|
@@ -4,7 +4,7 @@ v2024.1
|
|
- Update dependencies
|
|
- Propagate test/install options to Glslang
|
|
|
|
-v2024.0
|
|
+v2024.0 2024-03-09
|
|
- Update dependencies
|
|
- Utilities:
|
|
- Use Python3 explicitly in utility scripts
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index ffcb54b..7c1a6d8 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -117,6 +117,9 @@ if(MSVC)
|
|
endif()
|
|
endif(MSVC)
|
|
|
|
+if(NOT WIN32)
|
|
+ add_definitions("-fvisibility=hidden")
|
|
+endif()
|
|
|
|
# Configure subdirectories.
|
|
# We depend on these for later projects, so they should come first.
|
|
@@ -124,7 +127,6 @@ add_subdirectory(third_party)
|
|
|
|
add_subdirectory(libshaderc_util)
|
|
add_subdirectory(libshaderc)
|
|
-add_subdirectory(glslc)
|
|
if(${SHADERC_ENABLE_EXAMPLES})
|
|
add_subdirectory(examples)
|
|
endif()
|
|
@@ -158,5 +160,3 @@ function(define_pkg_config_file NAME LIBS)
|
|
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/libshaderc/CMakeLists.txt b/libshaderc/CMakeLists.txt
|
|
index df9a88d..b15e5d7 100644
|
|
--- a/libshaderc/CMakeLists.txt
|
|
+++ b/libshaderc/CMakeLists.txt
|
|
@@ -24,13 +24,6 @@ set(SHADERC_SOURCES
|
|
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
|
|
@@ -54,7 +47,7 @@ if(SHADERC_ENABLE_INSTALL)
|
|
DESTINATION
|
|
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
|
|
|
|
- install(TARGETS shaderc shaderc_shared
|
|
+ install(TARGETS shaderc_shared
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
@@ -69,20 +62,8 @@ set(SHADERC_LIBS
|
|
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
|
|
@@ -94,22 +75,6 @@ shaderc_add_tests(
|
|
shaderc_cpp
|
|
shaderc_private)
|
|
|
|
-shaderc_combine_static_lib(shaderc_combined shaderc)
|
|
-
|
|
-if(SHADERC_ENABLE_INSTALL)
|
|
- install(TARGETS shaderc_combined DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
-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)
|
|
diff --git a/libshaderc/include/shaderc/shaderc.h b/libshaderc/include/shaderc/shaderc.h
|
|
index 3a3e97d..65d5b77 100644
|
|
--- a/libshaderc/include/shaderc/shaderc.h
|
|
+++ b/libshaderc/include/shaderc/shaderc.h
|
|
@@ -15,6 +15,8 @@
|
|
#ifndef SHADERC_SHADERC_H_
|
|
#define SHADERC_SHADERC_H_
|
|
|
|
+#define SHADERC_PCSX2_CUSTOM 1
|
|
+
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
@@ -317,7 +317,7 @@ SHADERC_EXPORT void shaderc_compile_options_set_source_language(
|
|
|
|
// 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);
|
|
+ shaderc_compile_options_t options, bool enabled, bool enable_non_semantic);
|
|
|
|
// Sets the compiler optimization level to the given level. Only the last one
|
|
// takes effect if multiple calls of this function exist.
|
|
diff --git a/libshaderc/include/shaderc/shaderc.hpp b/libshaderc/include/shaderc/shaderc.hpp
|
|
index 3817af8..5592b49 100644
|
|
--- a/libshaderc/include/shaderc/shaderc.hpp
|
|
+++ b/libshaderc/include/shaderc/shaderc.hpp
|
|
@@ -168,8 +168,9 @@ class CompileOptions {
|
|
}
|
|
|
|
// Sets the compiler mode to generate debug information in the output.
|
|
- void SetGenerateDebugInfo() {
|
|
- shaderc_compile_options_set_generate_debug_info(options_);
|
|
+ void SetGenerateDebugInfo(bool enabled, bool non_semantic_debug_info) {
|
|
+ shaderc_compile_options_set_generate_debug_info(options_, enabled,
|
|
+ non_sematic_debug_info);
|
|
}
|
|
|
|
// Sets the compiler optimization level to the given level. Only the last one
|
|
diff --git a/libshaderc/src/shaderc.cc b/libshaderc/src/shaderc.cc
|
|
index 63f1bbc..c1a9b12 100644
|
|
--- a/libshaderc/src/shaderc.cc
|
|
+++ b/libshaderc/src/shaderc.cc
|
|
@@ -418,8 +418,12 @@ void shaderc_compile_options_set_source_language(
|
|
}
|
|
|
|
void shaderc_compile_options_set_generate_debug_info(
|
|
- shaderc_compile_options_t options) {
|
|
- options->compiler.SetGenerateDebugInfo();
|
|
+ shaderc_compile_options_t options, bool enabled, bool enable_non_semantic) {
|
|
+ if (enabled) {
|
|
+ options->compiler.SetGenerateDebugInfo();
|
|
+ if (enable_non_semantic)
|
|
+ options->compiler.SetEmitNonSemanticDebugInfo();
|
|
+ }
|
|
}
|
|
|
|
void shaderc_compile_options_set_optimization_level(
|
|
diff --git a/libshaderc_util/include/libshaderc_util/compiler.h b/libshaderc_util/include/libshaderc_util/compiler.h
|
|
index d9d02b9..b076ec8 100644
|
|
--- a/libshaderc_util/include/libshaderc_util/compiler.h
|
|
+++ b/libshaderc_util/include/libshaderc_util/compiler.h
|
|
@@ -195,6 +195,7 @@ class Compiler {
|
|
warnings_as_errors_(false),
|
|
suppress_warnings_(false),
|
|
generate_debug_info_(false),
|
|
+ emit_non_semantic_debug_info_(false),
|
|
enabled_opt_passes_(),
|
|
target_env_(TargetEnv::Vulkan),
|
|
target_env_version_(TargetEnvVersion::Default),
|
|
@@ -220,6 +221,10 @@ class Compiler {
|
|
// such as identifier names and line numbers.
|
|
void SetGenerateDebugInfo();
|
|
|
|
+ // Requests that the compiler emit non-semantic debug information.
|
|
+ // Requires VK_KHR_shader_non_semantic_info.
|
|
+ void SetEmitNonSemanticDebugInfo();
|
|
+
|
|
// 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);
|
|
@@ -486,6 +491,10 @@ class Compiler {
|
|
// output.
|
|
bool generate_debug_info_;
|
|
|
|
+ // When true and generate_debug_info_ is also set, generate non-semantic debug
|
|
+ // information.
|
|
+ bool emit_non_semantic_debug_info_;
|
|
+
|
|
// Optimization passes to be applied.
|
|
std::vector<PassId> enabled_opt_passes_;
|
|
|
|
diff --git a/libshaderc_util/src/compiler.cc b/libshaderc_util/src/compiler.cc
|
|
index e5f5d10..1f9e6a5 100644
|
|
--- a/libshaderc_util/src/compiler.cc
|
|
+++ b/libshaderc_util/src/compiler.cc
|
|
@@ -341,6 +341,11 @@ std::tuple<bool, std::vector<uint32_t>, size_t> Compiler::Compile(
|
|
options.generateDebugInfo = generate_debug_info_;
|
|
options.disableOptimizer = true;
|
|
options.optimizeSize = false;
|
|
+ options.emitNonSemanticShaderDebugInfo =
|
|
+ generate_debug_info_ && emit_non_semantic_debug_info_;
|
|
+ options.emitNonSemanticShaderDebugSource =
|
|
+ generate_debug_info_ && emit_non_semantic_debug_info_;
|
|
+
|
|
// Note the call to GlslangToSpv also populates compilation_output_data.
|
|
glslang::GlslangToSpv(*program.getIntermediate(used_shader_stage), spirv,
|
|
&options);
|
|
@@ -438,6 +443,10 @@ void Compiler::SetGenerateDebugInfo() {
|
|
}
|
|
}
|
|
|
|
+void Compiler::SetEmitNonSemanticDebugInfo() {
|
|
+ emit_non_semantic_debug_info_ = true;
|
|
+}
|
|
+
|
|
void Compiler::SetOptimizationLevel(Compiler::OptimizationLevel level) {
|
|
// Clear previous settings first.
|
|
enabled_opt_passes_.clear();
|
|
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
|
|
index d44f62a..83966b6 100644
|
|
--- a/third_party/CMakeLists.txt
|
|
+++ b/third_party/CMakeLists.txt
|
|
@@ -20,9 +20,9 @@ set(SHADERC_TINT_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/tint" CACHE STRING
|
|
set(SHADERC_ABSL_DIR "${SHADERC_THIRD_PARTY_ROOT_DIR}/abseil_cpp" CACHE STRING
|
|
"Location of re2 source")
|
|
|
|
-set( SKIP_GLSLANG_INSTALL ${SHADERC_SKIP_INSTALL} )
|
|
-set( SKIP_SPIRV_TOOLS_INSTALL ${SHADERC_SKIP_INSTALL} )
|
|
-set( SKIP_GOOGLETEST_INSTALL ${SHADERC_SKIP_INSTALL} )
|
|
+set( SKIP_GLSLANG_INSTALL ON )
|
|
+set( SKIP_SPIRV_TOOLS_INSTALL ON )
|
|
+set( SKIP_GOOGLETEST_INSTALL ON )
|
|
|
|
# Configure third party projects.
|
|
if(${SHADERC_ENABLE_TESTS})
|
|
@@ -64,7 +64,10 @@ if (NOT TARGET SPIRV-Tools)
|
|
add_subdirectory(${SHADERC_RE2_DIR} re2)
|
|
add_subdirectory(${SHADERC_EFFCEE_DIR} effcee)
|
|
endif()
|
|
- add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools)
|
|
+ set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "Skip building SPIRV-Tools executables")
|
|
+ set(SPIRV_TOOLS_BUILD_STATIC OFF CACHE BOOL "Skip building two SPIRV-Tools libs")
|
|
+ set(SPIRV_TOOLS_LIBRARY_TYPE STATIC CACHE STRING "Build static SPIRV-Tools libs")
|
|
+ add_subdirectory(${SHADERC_SPIRV_TOOLS_DIR} spirv-tools EXCLUDE_FROM_ALL)
|
|
if (NOT "${SPIRV_SKIP_TESTS}")
|
|
if (MSVC)
|
|
if (${MSVC_VERSION} LESS 1920)
|
|
@@ -87,8 +90,8 @@ if (NOT TARGET glslang)
|
|
# Glslang tests are off by default. Turn them on if testing Shaderc.
|
|
set(GLSLANG_TESTS ON)
|
|
endif()
|
|
- set(GLSLANG_ENABLE_INSTALL $<NOT:${SKIP_GLSLANG_INSTALL}>)
|
|
- add_subdirectory(${SHADERC_GLSLANG_DIR} glslang)
|
|
+ set(GLSLANG_ENABLE_INSTALL OFF)
|
|
+ add_subdirectory(${SHADERC_GLSLANG_DIR} glslang EXCLUDE_FROM_ALL)
|
|
endif()
|
|
if (NOT TARGET glslang)
|
|
message(FATAL_ERROR "glslang was not found - required for compilation")
|