Skip to content
Snippets Groups Projects
Unverified Commit 7be6dd85 authored by Jacki's avatar Jacki
Browse files

Update shady submodule


Signed-off-by: default avatarJacki <jacki@thejackimonster.de>
parent 13731ef4
No related branches found
No related tags found
No related merge requests found
...@@ -57,8 +57,6 @@ if (${slang_status}) ...@@ -57,8 +57,6 @@ if (${slang_status})
set(SLANG_STDLIB_META_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${vkcv_shader_compiler_lib}/slang/source/slang/stdlib-meta) set(SLANG_STDLIB_META_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${vkcv_shader_compiler_lib}/slang/source/slang/stdlib-meta)
target_include_directories(slang BEFORE PUBLIC ${SLANG_STDLIB_META_OUTPUT_DIR}) target_include_directories(slang BEFORE PUBLIC ${SLANG_STDLIB_META_OUTPUT_DIR})
message(WARNING ${SLANG_STDLIB_META_OUTPUT_DIR})
list(APPEND vkcv_shader_compiler_libraries slang lz4_static miniz unordered_dense::unordered_dense) list(APPEND vkcv_shader_compiler_libraries slang lz4_static miniz unordered_dense::unordered_dense)
list(APPEND vkcv_shader_compiler_includes ${vkcv_shader_compiler_lib}/slang/include ${slang_system_includes}) list(APPEND vkcv_shader_compiler_includes ${vkcv_shader_compiler_lib}/slang/include ${slang_system_includes})
......
...@@ -4,12 +4,19 @@ use_git_submodule("${vkcv_shader_compiler_lib_path}/shady" shady_status) ...@@ -4,12 +4,19 @@ use_git_submodule("${vkcv_shader_compiler_lib_path}/shady" shady_status)
if (${shady_status}) if (${shady_status})
set(EXTERNAL_JSON_C ON CACHE INTERNAL "") set(EXTERNAL_JSON_C ON CACHE INTERNAL "")
set(EXTERNAL_SPIRV_HEADERS ON CACHE INTERNAL "") set(EXTERNAL_SPIRV_HEADERS ON CACHE INTERNAL "")
set(EXTERNAL_MURMUR3 ON CACHE INTERNAL "")
set(EXTERNAL_JSON_C_INCLUDE ${JSON_C_INCLUDE_DIR} CACHE INTERNAL "") set(EXTERNAL_JSON_C_INCLUDE ${JSON_C_INCLUDE_DIR} CACHE INTERNAL "")
set(BUILD_RUNTIME OFF CACHE INTERNAL "") set(BUILD_RUNTIME OFF CACHE INTERNAL "")
set(BUILD_SAMPLES OFF CACHE INTERNAL "") set(BUILD_SAMPLES OFF CACHE INTERNAL "")
if (vkcv_build_attribute EQUAL "SHARED")
set(BUILD_SHARED_LIBS ON CACHE INTERNAL "")
else ()
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
endif ()
set(SHADY_ENABLE_JAVA_BINDINGS OFF CACHE INTERNAL "")
add_subdirectory(${vkcv_shader_compiler_lib}/shady) add_subdirectory(${vkcv_shader_compiler_lib}/shady)
......
Subproject commit 31e9f66867a4803bae0c3c6ca08adaf71bf4f818 Subproject commit bff2671298293f05e3f74c2add8de1c0a0279a14
...@@ -6,23 +6,27 @@ ...@@ -6,23 +6,27 @@
extern "C" { extern "C" {
#include <shady/driver.h> #include <shady/driver.h>
#include <shady/ir.h>
} }
namespace vkcv::shader { namespace vkcv::shader {
LLVMCompiler::LLVMCompiler(LLVMCompileTarget target) LLVMCompiler::LLVMCompiler(LLVMCompileTarget target)
: ShadyCompiler(), m_target(target) {} : ShadyCompiler(), m_target(target) {}
static bool shadyCompileModule(Module* module, static bool shadyCompileModule(Module* module,
ShaderStage shaderStage, ShaderStage shaderStage,
const std::string& shaderSource, const std::string& shaderSource,
const ShaderCompiledFunction &compiled, const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) { const std::filesystem::path &includePath) {
ShadyErrorCodes codes = driver_load_source_file( CompilerConfig compiler = shd_default_compiler_config();
SrcLLVM, ShadyErrorCodes codes = shd_driver_load_source_file(
shaderSource.length(), &compiler,
SrcLLVM,
shaderSource.length(),
shaderSource.c_str(), shaderSource.c_str(),
module "main",
&module
); );
switch (codes) { switch (codes) {
...@@ -44,13 +48,13 @@ namespace vkcv::shader { ...@@ -44,13 +48,13 @@ namespace vkcv::shader {
const std::filesystem::path tmp_path = generateTemporaryFilePath(); const std::filesystem::path tmp_path = generateTemporaryFilePath();
DriverConfig config = default_driver_config(); DriverConfig config = shd_default_driver_config();
config.target = TgtSPV; config.target = TgtSPV;
config.output_filename = tmp_path.string().c_str(); config.output_filename = tmp_path.string().c_str();
codes = driver_compile(&config, module); codes = shd_driver_compile(&config, module);
destroy_driver_config(&config); shd_destroy_driver_config(&config);
switch (codes) { switch (codes) {
case NoError: case NoError:
...@@ -77,12 +81,12 @@ namespace vkcv::shader { ...@@ -77,12 +81,12 @@ namespace vkcv::shader {
return true; return true;
} }
static bool shadyCompileArena(IrArena* arena, static bool shadyCompileArena(IrArena* arena,
ShaderStage shaderStage, ShaderStage shaderStage,
const std::string& shaderSource, const std::string& shaderSource,
const ShaderCompiledFunction &compiled, const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) { const std::filesystem::path &includePath) {
Module* module = new_module(arena, "slim_module"); Module* module = shd_new_module(arena, "slim_module");
if (nullptr == module) { if (nullptr == module) {
vkcv_log(LogLevel::ERROR, "Module could not be created"); vkcv_log(LogLevel::ERROR, "Module could not be created");
...@@ -92,17 +96,18 @@ namespace vkcv::shader { ...@@ -92,17 +96,18 @@ namespace vkcv::shader {
return shadyCompileModule(module, shaderStage, shaderSource, compiled, includePath); return shadyCompileModule(module, shaderStage, shaderSource, compiled, includePath);
} }
bool LLVMCompiler::compileSource(ShaderStage shaderStage, bool LLVMCompiler::compileSource(ShaderStage shaderStage,
const std::string& shaderSource, const std::string& shaderSource,
const ShaderCompiledFunction& compiled, const ShaderCompiledFunction& compiled,
const std::filesystem::path& includePath) { const std::filesystem::path& includePath) {
if (ShaderStage::COMPUTE != shaderStage) { if (ShaderStage::COMPUTE != shaderStage) {
vkcv_log(LogLevel::ERROR, "Shader stage not supported"); vkcv_log(LogLevel::ERROR, "Shader stage not supported");
return false; return false;
} }
ArenaConfig config = default_arena_config(); TargetConfig target = shd_default_target_config();
IrArena* arena = new_ir_arena(config); ArenaConfig config = shd_default_arena_config(&target);
IrArena* arena = shd_new_ir_arena(&config);
if (nullptr == arena) { if (nullptr == arena) {
vkcv_log(LogLevel::ERROR, "IR Arena could not be created"); vkcv_log(LogLevel::ERROR, "IR Arena could not be created");
...@@ -111,8 +116,8 @@ namespace vkcv::shader { ...@@ -111,8 +116,8 @@ namespace vkcv::shader {
bool result = shadyCompileArena(arena, shaderStage, shaderSource, compiled, includePath); bool result = shadyCompileArena(arena, shaderStage, shaderSource, compiled, includePath);
destroy_ir_arena(arena); shd_destroy_ir_arena(arena);
return result; return result;
} }
} }
...@@ -6,23 +6,27 @@ ...@@ -6,23 +6,27 @@
extern "C" { extern "C" {
#include <shady/driver.h> #include <shady/driver.h>
#include <shady/ir.h>
} }
namespace vkcv::shader { namespace vkcv::shader {
SlimCompiler::SlimCompiler(SlimCompileTarget target) SlimCompiler::SlimCompiler(SlimCompileTarget target)
: ShadyCompiler(), m_target(target) {} : ShadyCompiler(), m_target(target) {}
static bool shadyCompileModule(Module* module, static bool shadyCompileModule(Module* module,
ShaderStage shaderStage, ShaderStage shaderStage,
const std::string& shaderSource, const std::string& shaderSource,
const ShaderCompiledFunction &compiled, const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) { const std::filesystem::path &includePath) {
ShadyErrorCodes codes = driver_load_source_file( CompilerConfig compiler = shd_default_compiler_config();
ShadyErrorCodes codes = shd_driver_load_source_file(
&compiler,
SrcSlim, SrcSlim,
shaderSource.length(), shaderSource.length(),
shaderSource.c_str(), shaderSource.c_str(),
module "main",
&module
); );
switch (codes) { switch (codes) {
...@@ -44,13 +48,13 @@ namespace vkcv::shader { ...@@ -44,13 +48,13 @@ namespace vkcv::shader {
const std::filesystem::path tmp_path = generateTemporaryFilePath(); const std::filesystem::path tmp_path = generateTemporaryFilePath();
DriverConfig config = default_driver_config(); DriverConfig config = shd_default_driver_config();
config.target = TgtSPV; config.target = TgtSPV;
config.output_filename = tmp_path.string().c_str(); config.output_filename = tmp_path.string().c_str();
codes = driver_compile(&config, module); codes = shd_driver_compile(&config, module);
destroy_driver_config(&config); shd_destroy_driver_config(&config);
switch (codes) { switch (codes) {
case NoError: case NoError:
...@@ -82,7 +86,7 @@ namespace vkcv::shader { ...@@ -82,7 +86,7 @@ namespace vkcv::shader {
const std::string& shaderSource, const std::string& shaderSource,
const ShaderCompiledFunction &compiled, const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) { const std::filesystem::path &includePath) {
Module* module = new_module(arena, "slim_module"); Module* module = shd_new_module(arena, "slim_module");
if (nullptr == module) { if (nullptr == module) {
vkcv_log(LogLevel::ERROR, "Module could not be created"); vkcv_log(LogLevel::ERROR, "Module could not be created");
...@@ -101,8 +105,9 @@ namespace vkcv::shader { ...@@ -101,8 +105,9 @@ namespace vkcv::shader {
return false; return false;
} }
ArenaConfig config = default_arena_config(); TargetConfig target = shd_default_target_config();
IrArena* arena = new_ir_arena(config); ArenaConfig config = shd_default_arena_config(&target);
IrArena* arena = shd_new_ir_arena(&config);
if (nullptr == arena) { if (nullptr == arena) {
vkcv_log(LogLevel::ERROR, "IR Arena could not be created"); vkcv_log(LogLevel::ERROR, "IR Arena could not be created");
...@@ -111,7 +116,7 @@ namespace vkcv::shader { ...@@ -111,7 +116,7 @@ namespace vkcv::shader {
bool result = shadyCompileArena(arena, shaderStage, shaderSource, compiled, includePath); bool result = shadyCompileArena(arena, shaderStage, shaderSource, compiled, includePath);
destroy_ir_arena(arena); shd_destroy_ir_arena(arena);
return result; return result;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment