Blender Git Loki
Git Commits -> Revision 193a174
Revision 193a174 by Jeroen Bakker (tmp-vulkan) June 23, 2021, 12:04 (GMT) |
Added shader compiler abstration. The shader_compiler is an abstration layer for in case we need to switch between other shader compilers in the future. The shader compiler uses a CPP Api as it will only be accessed from GPU module. ``` const char *source = "#version 450nvoid main() {}"; shader_compiler::Compiler *compiler = shader_compiler::Compiler::create_default(); shader_compiler::Job job; job.source = source; job.name = __func__; job.source_type = shader_compiler::SourceType::GlslComputeShader; job.compilation_target = shader_compiler::TargetType::SpirV; shader_compiler::Result *result = compiler->compile(job); EXPECT_EQ(result->type, shader_compiler::TargetType::SpirV); EXPECT_EQ(result->status_code, shader_compiler::StatusCode::Ok); EXPECT_GT(result->bin.size(), 0); EXPECT_EQ(result->error_log, ""); delete result; delete compiler; ``` The CMakeFiles need some attention as it currently works when linking to the shaderlib_combined. On linux it picks up the shaderlib from the vulkan SDK, eventually it needs to pick up from our prebuild libraries. |
Commit Details:
Full Hash: 193a17474e66c95b6095904aa81c5ab0a6c77748
Parent Commit: 5b246fd
Lines Changed: +413, -1
10 Added Paths:
/build_files/cmake/Modules/FindShaderC.cmake (+66, -0) (View)
/intern/shader_compiler/CMakeLists.txt (+47, -0) (View)
/intern/shader_compiler/intern/Compiler.cc (+13, -0) (View)
/intern/shader_compiler/intern/Result.cc (+10, -0) (View)
/intern/shader_compiler/intern/shaderc/ShaderCCompiler.cc (+65, -0) (View)
/intern/shader_compiler/intern/shaderc/ShaderCCompiler.hh (+25, -0) (View)
/intern/shader_compiler/intern/shaderc/ShaderCResult.cc (+40, -0) (View)
/intern/shader_compiler/intern/shaderc/ShaderCResult.hh (+20, -0) (View)
/intern/shader_compiler/shader_compiler.hh (+88, -0) (View)
/source/blender/gpu/tests/gpu_shader_compiler_test.cc (+28, -0) (View)
/intern/shader_compiler/CMakeLists.txt (+47, -0) (View)
/intern/shader_compiler/intern/Compiler.cc (+13, -0) (View)
/intern/shader_compiler/intern/Result.cc (+10, -0) (View)
/intern/shader_compiler/intern/shaderc/ShaderCCompiler.cc (+65, -0) (View)
/intern/shader_compiler/intern/shaderc/ShaderCCompiler.hh (+25, -0) (View)
/intern/shader_compiler/intern/shaderc/ShaderCResult.cc (+40, -0) (View)
/intern/shader_compiler/intern/shaderc/ShaderCResult.hh (+20, -0) (View)
/intern/shader_compiler/shader_compiler.hh (+88, -0) (View)
/source/blender/gpu/tests/gpu_shader_compiler_test.cc (+28, -0) (View)