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})
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})
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_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)
if (${shady_status})
set(EXTERNAL_JSON_C 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(BUILD_RUNTIME 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)
......
Subproject commit 31e9f66867a4803bae0c3c6ca08adaf71bf4f818
Subproject commit bff2671298293f05e3f74c2add8de1c0a0279a14
......@@ -6,23 +6,27 @@
extern "C" {
#include <shady/driver.h>
#include <shady/ir.h>
}
namespace vkcv::shader {
LLVMCompiler::LLVMCompiler(LLVMCompileTarget target)
: ShadyCompiler(), m_target(target) {}
static bool shadyCompileModule(Module* module,
ShaderStage shaderStage,
const std::string& shaderSource,
const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) {
ShadyErrorCodes codes = driver_load_source_file(
SrcLLVM,
shaderSource.length(),
LLVMCompiler::LLVMCompiler(LLVMCompileTarget target)
: ShadyCompiler(), m_target(target) {}
static bool shadyCompileModule(Module* module,
ShaderStage shaderStage,
const std::string& shaderSource,
const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) {
CompilerConfig compiler = shd_default_compiler_config();
ShadyErrorCodes codes = shd_driver_load_source_file(
&compiler,
SrcLLVM,
shaderSource.length(),
shaderSource.c_str(),
module
"main",
&module
);
switch (codes) {
......@@ -44,13 +48,13 @@ namespace vkcv::shader {
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();
codes = driver_compile(&config, module);
destroy_driver_config(&config);
codes = shd_driver_compile(&config, module);
shd_destroy_driver_config(&config);
switch (codes) {
case NoError:
......@@ -77,12 +81,12 @@ namespace vkcv::shader {
return true;
}
static bool shadyCompileArena(IrArena* arena,
ShaderStage shaderStage,
const std::string& shaderSource,
const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) {
Module* module = new_module(arena, "slim_module");
static bool shadyCompileArena(IrArena* arena,
ShaderStage shaderStage,
const std::string& shaderSource,
const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) {
Module* module = shd_new_module(arena, "slim_module");
if (nullptr == module) {
vkcv_log(LogLevel::ERROR, "Module could not be created");
......@@ -92,17 +96,18 @@ namespace vkcv::shader {
return shadyCompileModule(module, shaderStage, shaderSource, compiled, includePath);
}
bool LLVMCompiler::compileSource(ShaderStage shaderStage,
const std::string& shaderSource,
const ShaderCompiledFunction& compiled,
const std::filesystem::path& includePath) {
if (ShaderStage::COMPUTE != shaderStage) {
bool LLVMCompiler::compileSource(ShaderStage shaderStage,
const std::string& shaderSource,
const ShaderCompiledFunction& compiled,
const std::filesystem::path& includePath) {
if (ShaderStage::COMPUTE != shaderStage) {
vkcv_log(LogLevel::ERROR, "Shader stage not supported");
return false;
}
ArenaConfig config = default_arena_config();
IrArena* arena = new_ir_arena(config);
TargetConfig target = shd_default_target_config();
ArenaConfig config = shd_default_arena_config(&target);
IrArena* arena = shd_new_ir_arena(&config);
if (nullptr == arena) {
vkcv_log(LogLevel::ERROR, "IR Arena could not be created");
......@@ -111,8 +116,8 @@ namespace vkcv::shader {
bool result = shadyCompileArena(arena, shaderStage, shaderSource, compiled, includePath);
destroy_ir_arena(arena);
return result;
}
shd_destroy_ir_arena(arena);
return result;
}
}
......@@ -6,23 +6,27 @@
extern "C" {
#include <shady/driver.h>
#include <shady/ir.h>
}
namespace vkcv::shader {
SlimCompiler::SlimCompiler(SlimCompileTarget target)
: ShadyCompiler(), m_target(target) {}
static bool shadyCompileModule(Module* module,
ShaderStage shaderStage,
const std::string& shaderSource,
const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) {
ShadyErrorCodes codes = driver_load_source_file(
SlimCompiler::SlimCompiler(SlimCompileTarget target)
: ShadyCompiler(), m_target(target) {}
static bool shadyCompileModule(Module* module,
ShaderStage shaderStage,
const std::string& shaderSource,
const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) {
CompilerConfig compiler = shd_default_compiler_config();
ShadyErrorCodes codes = shd_driver_load_source_file(
&compiler,
SrcSlim,
shaderSource.length(),
shaderSource.c_str(),
module
"main",
&module
);
switch (codes) {
......@@ -44,13 +48,13 @@ namespace vkcv::shader {
const std::filesystem::path tmp_path = generateTemporaryFilePath();
DriverConfig config = default_driver_config();
DriverConfig config = shd_default_driver_config();
config.target = TgtSPV;
config.output_filename = tmp_path.string().c_str();
codes = driver_compile(&config, module);
destroy_driver_config(&config);
codes = shd_driver_compile(&config, module);
shd_destroy_driver_config(&config);
switch (codes) {
case NoError:
......@@ -82,7 +86,7 @@ namespace vkcv::shader {
const std::string& shaderSource,
const ShaderCompiledFunction &compiled,
const std::filesystem::path &includePath) {
Module* module = new_module(arena, "slim_module");
Module* module = shd_new_module(arena, "slim_module");
if (nullptr == module) {
vkcv_log(LogLevel::ERROR, "Module could not be created");
......@@ -101,8 +105,9 @@ namespace vkcv::shader {
return false;
}
ArenaConfig config = default_arena_config();
IrArena* arena = new_ir_arena(config);
TargetConfig target = shd_default_target_config();
ArenaConfig config = shd_default_arena_config(&target);
IrArena* arena = shd_new_ir_arena(&config);
if (nullptr == arena) {
vkcv_log(LogLevel::ERROR, "IR Arena could not be created");
......@@ -111,7 +116,7 @@ namespace vkcv::shader {
bool result = shadyCompileArena(arena, shaderStage, shaderSource, compiled, includePath);
destroy_ir_arena(arena);
shd_destroy_ir_arena(arena);
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