pub fn load_glsl_shader<'a, P: AsRef<Path>>(stage: ShaderStage, path: P) -> Vec<u8> {
    let ty = match stage {
        ShaderStage::Vertex => shaderc::ShaderKind::Vertex,
        ShaderStage::Fragment => shaderc::ShaderKind::Fragment,
    };
    let path_display = path.as_ref().display().to_string();
    log::info!("Loading GLSL shader from {}", path_display);
    let glsl_source = std::fs::read_to_string(path).expect("Couldn't read shader from file");

    let mut compiler = shaderc::Compiler::new().unwrap();
    compiler.compile_into_spirv(&glsl_source, ty, &path_display, "main", None)
        .expect("Couldn't compile shader.")
        .as_binary_u8()
        .to_vec()
}
/// Load a GLSL shader from a file and compile it to SPIR-V
Load a GLSL shader from a file and compile it to SPIR-V
Load a GLSL shader from a file and compile it to SPIR - V
pub fn load_glsl_shader<'a, P: AsRef<Path>>(stage: ShaderStage, path: P) -> Vec<u8> {
    let ty = match stage {
        ShaderStage::Vertex => shaderc::ShaderKind::Vertex,
        ShaderStage::Fragment => shaderc::ShaderKind::Fragment,
    };
    let path_display = path.as_ref().display().to_string();
    log::info!("Loading GLSL shader from {}", path_display);
    let glsl_source = std::fs::read_to_string(path).expect("Couldn't read shader from file");
    let mut compiler = shaderc::Compiler::new().unwrap();
    compiler.compile_into_spirv(&glsl_source, ty, &path_display, "main", None)
        .expect("Couldn't compile shader.")
        .as_binary_u8()
        .to_vec()
}
pub fn load_glsl_shader < ' a , P : AsRef < Path > > ( stage : ShaderStage , path : P ) -> Vec < u8 > { let ty = match stage { ShaderStage :: Vertex => shaderc :: ShaderKind :: Vertex , ShaderStage :: Fragment => shaderc :: ShaderKind :: Fragment , } ; let path_display = path . as_ref ( ) . display ( ) . to_string ( ) ; log :: info ! ( " " path_display ) ; let glsl_source = std :: fs :: read_to_string ( path ) . expect ( " " ) ; let mut compiler = shaderc :: Compiler :: new ( ) . unwrap ( ) ; compiler . compile_into_spirv ( & glsl_source , ty , & path_display , " " , None ) . expect ( " " ) . as_binary_u8 ( ) . to_vec ( ) }
Load a GLSL shader from a file and compile it to SPIR-V
Load a GLSL shader from a file and compile it to SPIR - V
stage
ShaderStage
path
P
stage
ShaderStage
path
P