Skip to main content

GLSLBackend

Struct GLSLBackend 

Source
pub struct GLSLBackend {
    pub version: GLSLVersion,
}
Expand description

Code generation backend that emits GLSL source text.

Fields§

§version: GLSLVersion

Target GLSL version.

Implementations§

Source§

impl GLSLBackend

Source

pub fn new(version: GLSLVersion) -> Self

Create a new backend targeting the specified GLSL version.

Source

pub fn emit_type(&self, ty: &GLSLType) -> String

Return the GLSL keyword string for a type.

Source

pub fn emit_shader(&self, shader: &GLSLShader) -> String

Emit a complete GLSL shader as a source string.

Source

pub fn vertex_shader_template(&self) -> String

Build a minimal vertex shader template that passes a position through.

Source

pub fn fragment_shader_template(&self) -> String

Build a minimal fragment (pixel) shader template that samples a texture.

Source

pub fn phong_vertex_template(&self) -> String

Build a Phong lighting vertex shader template.

Source

pub fn phong_fragment_template(&self) -> String

Build a Phong lighting fragment shader template.

Source

pub fn compute_shader_template( &self, local_x: u32, local_y: u32, local_z: u32, ) -> String

Build a compute shader template (GLSL 4.3+).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.