1pub use lambda_platform::shaderc::{
5 ShaderCompiler,
6 ShaderCompilerBuilder,
7 ShaderKind,
8 VirtualShader,
9};
10
11pub struct ShaderBuilder {
12 compiler: ShaderCompiler,
13}
14
15impl ShaderBuilder {
16 pub fn new() -> Self {
18 let compiler = ShaderCompilerBuilder::new().build();
19 return Self { compiler };
20 }
21
22 pub fn build(&mut self, virtual_shader: VirtualShader) -> Shader {
25 logging::trace!("Compiling shader: {:?}", virtual_shader);
26 let binary = self.compiler.compile_into_binary(&virtual_shader);
27
28 return Shader {
29 binary,
30 virtual_shader,
31 };
32 }
33}
34
35pub struct Shader {
39 binary: Vec<u32>,
40 virtual_shader: VirtualShader,
41}
42
43impl Shader {
44 pub fn as_binary(&self) -> Vec<u32> {
46 return self.binary.clone();
47 }
48}