Find
C
ase-sensitive
R
egexp search
Path
comm-central
/
third_party
/
rust
/
glsl
/
src
/
transpiler
Navigation
Enable keyboard shortcuts
Name
Description
Size
glsl.rs
A GLSL450/GLSL460 transpiler that takes a syntax tree and writes it as a plain raw GLSL [`String`]. # Foreword This module exports several functions that just transform a part of a syntax tree into its raw GLSL [`String`] representation. > Important note: this module – and actually, any [`transpiler`] module – is not responsible in > optimizing the syntax tree nor semantically check its validity. This is done in other stages > of the compilation process. In order to achieve that purpose, you could: - For each elements in the AST, return a [`String`] or [`Cow<str>`]. - Insert the string representation via a formatter. The second solution is better because it lets the user handle the memory the way they want: they might just use a dynamic buffer that implements [`Write`] or simply pass a `&mut` [`String`]. It’s up to you. # How to use this module First, head over to the [`syntax`] module. That module defines the AST items defined by GLSL. This very module provides you with functions like `show_*` taking the AST item and writing it to a [`Write`] object. You’re likely to be interested in [`show_translation_unit`] to start with. [`Cow<str>`]: std::borrow::Cow [`Write`]: std::fmt::Write [`show_translation_unit`]: crate::transpiler::glsl::show_translation_unit [`syntax`]: crate::syntax [`transpiler`]: crate::transpiler
49377
mod.rs
GLSL transpilers – i.e. going from GLSL to anything else. There’s no public interface / trait to define what a transpiler is. It depends on the target representation you aim.
251
spirv.rs
SPIR-V transpiler. The current implementation uses the [shaderc](https://crates.io/crates/shaderc) crate to transpile GLSL to SPIR-V. This is not ideal but will provide a default and starting implementation.
3010