mirror of
https://github.com/RPCSX/rpcsx.git
synced 2024-11-23 11:29:48 +00:00
cmake: don't give package managers a chance
include paths for system and source tree targets are different, need to fix it first use static version of spirv-cross
This commit is contained in:
parent
9a9006f2b4
commit
275e47e64f
56
3rdparty/CMakeLists.txt
vendored
56
3rdparty/CMakeLists.txt
vendored
@ -4,40 +4,32 @@ if(NOT xbyak_FOUND)
|
||||
add_subdirectory(xbyak)
|
||||
endif()
|
||||
|
||||
if(NOT SPIRV-Headers_FOUND)
|
||||
add_subdirectory(SPIRV-Headers)
|
||||
add_subdirectory(SPIRV-Headers)
|
||||
|
||||
add_subdirectory(SPIRV-Tools)
|
||||
|
||||
option(SPIRV_CROSS_SHARED "" on)
|
||||
option(SPIRV_CROSS_STATIC "" on)
|
||||
option(SPIRV_CROSS_ENABLE_GLSL "" on)
|
||||
option(SPIRV_CROSS_ENABLE_HLSL "" off)
|
||||
option(SPIRV_CROSS_ENABLE_MSL "" off)
|
||||
option(SPIRV_CROSS_ENABLE_CPP "" off)
|
||||
option(SPIRV_CROSS_ENABLE_REFLECT "" off)
|
||||
option(SPIRV_CROSS_ENABLE_C_API "" off)
|
||||
option(SPIRV_CROSS_ENABLE_UTIL "" off)
|
||||
option(SPIRV_CROSS_CLI "" off)
|
||||
option(SPIRV_CROSS_ENABLE_TESTS "" off)
|
||||
option(SPIRV_CROSS_SKIP_INSTALL "" on)
|
||||
add_subdirectory(SPIRV-Cross)
|
||||
|
||||
install(TARGETS spirv-cross-c-shared LIBRARY DESTINATION bin)
|
||||
set_target_properties(spirv-cross-c-shared PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
add_subdirectory(glslang)
|
||||
if(NOT TARGET glslang::glslang-standalone)
|
||||
add_executable(glslang::glslang-standalone ALIAS glslang-standalone)
|
||||
endif()
|
||||
|
||||
if(NOT SPIRV-Tools-opt_FOUND)
|
||||
add_subdirectory(SPIRV-Tools)
|
||||
endif()
|
||||
|
||||
if(NOT SPIRV-Cross_FOUND)
|
||||
option(SPIRV_CROSS_SHARED "" on)
|
||||
option(SPIRV_CROSS_STATIC "" on)
|
||||
option(SPIRV_CROSS_ENABLE_GLSL "" on)
|
||||
option(SPIRV_CROSS_ENABLE_HLSL "" off)
|
||||
option(SPIRV_CROSS_ENABLE_MSL "" off)
|
||||
option(SPIRV_CROSS_ENABLE_CPP "" off)
|
||||
option(SPIRV_CROSS_ENABLE_REFLECT "" off)
|
||||
option(SPIRV_CROSS_ENABLE_C_API "" off)
|
||||
option(SPIRV_CROSS_ENABLE_UTIL "" off)
|
||||
option(SPIRV_CROSS_CLI "" off)
|
||||
option(SPIRV_CROSS_ENABLE_TESTS "" off)
|
||||
option(SPIRV_CROSS_SKIP_INSTALL "" on)
|
||||
add_subdirectory(SPIRV-Cross)
|
||||
|
||||
install(TARGETS spirv-cross-c-shared LIBRARY DESTINATION bin)
|
||||
set_target_properties(spirv-cross-c-shared PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
endif()
|
||||
|
||||
# if(NOT glslang_FOUND)
|
||||
add_subdirectory(glslang)
|
||||
if(NOT TARGET glslang::glslang-standalone)
|
||||
add_executable(glslang::glslang-standalone ALIAS glslang-standalone)
|
||||
endif()
|
||||
# endif()
|
||||
|
||||
if(NOT nlohmann_json_FOUND)
|
||||
add_subdirectory(json)
|
||||
endif()
|
||||
|
@ -9,15 +9,6 @@ set(CMAKE_BUILD_RPATH_USE_ORIGIN on)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
find_package(nlohmann_json CONFIG)
|
||||
find_package(SPIRV-Cross 1.6 MODULE)
|
||||
find_package(SPIRV-Tools-opt MODULE)
|
||||
find_package(xbyak CONFIG)
|
||||
|
||||
if(SPIRV-Tools-opt_FOUND)
|
||||
find_package(glslang CONFIG)
|
||||
find_package(SPIRV-Headers CONFIG)
|
||||
endif()
|
||||
|
||||
add_subdirectory(3rdparty EXCLUDE_FROM_ALL)
|
||||
|
||||
function(add_precompiled_vulkan_spirv target)
|
||||
|
@ -42,7 +42,7 @@ PRIVATE
|
||||
glslang::SPIRV
|
||||
SPIRV-Tools
|
||||
SPIRV-Tools-opt
|
||||
spirv-cross-c-shared
|
||||
spirv-cross-glsl
|
||||
)
|
||||
|
||||
add_subdirectory(shaders)
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "transform.hpp"
|
||||
#include <glslang/Include/ResourceLimits.h>
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
#include <glslang/SPIRV/GlslangToSpv.h>
|
||||
#include <SPIRV/GlslangToSpv.h>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <print>
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
#include <spirv_cross_c.h>
|
||||
#include <spirv_cross.hpp>
|
||||
#include <spirv_glsl.hpp>
|
||||
|
||||
static constexpr auto g_glslangLimit = 100;
|
||||
|
||||
@ -294,41 +295,11 @@ shader::glsl::parseSource(ir::Context &context, Stage stage,
|
||||
}
|
||||
|
||||
std::string shader::glsl::decompile(std::span<const std::uint32_t> spv) {
|
||||
spvc_context context = nullptr;
|
||||
spvc_parsed_ir ir = nullptr;
|
||||
spvc_compiler compiler_glsl = nullptr;
|
||||
spvc_compiler_options options = nullptr;
|
||||
const char *result = nullptr;
|
||||
|
||||
spvc_context_create(&context);
|
||||
|
||||
spvc_context_set_error_callback(
|
||||
context,
|
||||
[](void *, const char *message) {
|
||||
std::fprintf(stderr, "%s\n", message);
|
||||
},
|
||||
nullptr);
|
||||
|
||||
spvc_context_parse_spirv(context, spv.data(), spv.size(), &ir);
|
||||
spvc_context_create_compiler(context, SPVC_BACKEND_GLSL, ir,
|
||||
SPVC_CAPTURE_MODE_TAKE_OWNERSHIP,
|
||||
&compiler_glsl);
|
||||
|
||||
spvc_compiler_create_compiler_options(compiler_glsl, &options);
|
||||
spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_GLSL_VERSION,
|
||||
460);
|
||||
spvc_compiler_options_set_bool(options, SPVC_COMPILER_OPTION_GLSL_ES,
|
||||
SPVC_FALSE);
|
||||
spvc_compiler_options_set_bool(
|
||||
options, SPVC_COMPILER_OPTION_GLSL_VULKAN_SEMANTICS, SPVC_TRUE);
|
||||
spvc_compiler_install_compiler_options(compiler_glsl, options);
|
||||
|
||||
if (spvc_compiler_compile(compiler_glsl, &result) != SPVC_SUCCESS) {
|
||||
spvc_context_destroy(context);
|
||||
return {};
|
||||
}
|
||||
std::string resultStr = result;
|
||||
spvc_context_destroy(context);
|
||||
|
||||
return resultStr;
|
||||
spirv_cross::CompilerGLSL glsl(spv.data(), spv.size());
|
||||
spirv_cross::CompilerGLSL::Options options;
|
||||
options.version = 460;
|
||||
options.es = false;
|
||||
options.vulkan_semantics = true;
|
||||
glsl.set_common_options(options);
|
||||
return glsl.compile();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user