Skip to content
Snippets Groups Projects
Commit ca77a04e authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Merge branch '144-slang-compiler' into 'develop'

Resolve "Slang Compiler"

Closes #144

See merge request !115
parents ea60d494 c7b5f3c2
No related branches found
No related tags found
1 merge request!115Resolve "Slang Compiler"
...@@ -14,15 +14,15 @@ namespace vkcv::shader { ...@@ -14,15 +14,15 @@ namespace vkcv::shader {
: 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( ShadyErrorCodes codes = driver_load_source_file(
SrcSlim, SrcSlim,
shaderSource.length(), shaderSource.length(),
shaderSource.c_str(), shaderSource.c_str(),
module module
); );
switch (codes) { switch (codes) {
...@@ -46,7 +46,7 @@ namespace vkcv::shader { ...@@ -46,7 +46,7 @@ namespace vkcv::shader {
DriverConfig config = default_driver_config(); DriverConfig config = 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 = driver_compile(&config, module);
...@@ -78,10 +78,10 @@ namespace vkcv::shader { ...@@ -78,10 +78,10 @@ namespace vkcv::shader {
} }
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 = new_module(arena, "slim_module");
if (nullptr == module) { if (nullptr == module) {
...@@ -92,11 +92,11 @@ namespace vkcv::shader { ...@@ -92,11 +92,11 @@ namespace vkcv::shader {
return shadyCompileModule(module, shaderStage, shaderSource, compiled, includePath); return shadyCompileModule(module, shaderStage, shaderSource, compiled, includePath);
} }
bool SlimCompiler::compileSource(ShaderStage shaderStage, bool SlimCompiler::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;
} }
...@@ -112,7 +112,7 @@ namespace vkcv::shader { ...@@ -112,7 +112,7 @@ namespace vkcv::shader {
bool result = shadyCompileArena(arena, shaderStage, shaderSource, compiled, includePath); bool result = shadyCompileArena(arena, shaderStage, shaderSource, compiled, includePath);
destroy_ir_arena(arena); 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