GraphicsContext

Trait GraphicsContext 

Source
pub unsafe trait GraphicsContext: Sized {
    type Backend;

    // Required method
    fn backend(&mut self) -> &mut Self::Backend;

    // Provided methods
    fn query(&mut self) -> Query<'_, Self::Backend>
       where Self::Backend: Query { ... }
    fn new_pipeline_gate(&mut self) -> PipelineGate<'_, Self::Backend> { ... }
    fn new_framebuffer<D, CS, DS>(
        &mut self,
        size: <D as Dimensionable>::Size,
        mipmaps: usize,
        sampler: Sampler,
    ) -> Result<Framebuffer<Self::Backend, D, CS, DS>, FramebufferError>
       where Self::Backend: Framebuffer<D>,
             D: Dimensionable,
             CS: ColorSlot<Self::Backend, D>,
             DS: DepthStencilSlot<Self::Backend, D> { ... }
    fn new_shader_stage<R>(
        &mut self,
        ty: StageType,
        src: R,
    ) -> Result<Stage<Self::Backend>, StageError>
       where Self::Backend: Shader,
             R: AsRef<str> { ... }
    fn new_shader_program<Sem, Out, Uni>(
        &mut self,
    ) -> ProgramBuilder<'_, Self, Sem, Out, Uni>
       where Self::Backend: Shader,
             Sem: Semantics { ... }
    fn new_shader_data<T>(
        &mut self,
        values: impl IntoIterator<Item = T>,
    ) -> Result<ShaderData<Self::Backend, T>, ShaderDataError>
       where Self::Backend: ShaderData<T> { ... }
    fn new_tess(&mut self) -> TessBuilder<'_, Self::Backend, ()>
       where Self::Backend: Tess<(), (), (), Interleaved> { ... }
    fn new_deinterleaved_tess<V, W>(
        &mut self,
    ) -> TessBuilder<'_, Self::Backend, V, (), W, Deinterleaved>
       where Self::Backend: Tess<V, (), W, Deinterleaved>,
             V: TessVertexData<Deinterleaved>,
             W: TessVertexData<Deinterleaved> { ... }
    fn new_texture<D, P>(
        &mut self,
        size: <D as Dimensionable>::Size,
        sampler: Sampler,
        texels: TexelUpload<'_, [<P as Pixel>::Encoding]>,
    ) -> Result<Texture<Self::Backend, D, P>, TextureError>
       where Self::Backend: Texture<D, P>,
             D: Dimensionable,
             P: Pixel { ... }
    fn new_texture_raw<D, P>(
        &mut self,
        size: <D as Dimensionable>::Size,
        sampler: Sampler,
        texels: TexelUpload<'_, [<P as Pixel>::RawEncoding]>,
    ) -> Result<Texture<Self::Backend, D, P>, TextureError>
       where Self::Backend: Texture<D, P>,
             D: Dimensionable,
             P: Pixel { ... }
}
Expand description

Class of graphics context.

Graphics context must implement this trait to be able to be used throughout the rest of the crate.

Required Associated Types§

Source

type Backend

Internal type used by the backend to cache, optimize and store data. This roughly represents the GPU data / context a backend implementation needs to work correctly.

Required Methods§

Source

fn backend(&mut self) -> &mut Self::Backend

Access the underlying backend.

Provided Methods§

Source

fn query(&mut self) -> Query<'_, Self::Backend>
where Self::Backend: Query,

Access the query API.

Source

fn new_pipeline_gate(&mut self) -> PipelineGate<'_, Self::Backend>

Create a new pipeline gate

Source

fn new_framebuffer<D, CS, DS>( &mut self, size: <D as Dimensionable>::Size, mipmaps: usize, sampler: Sampler, ) -> Result<Framebuffer<Self::Backend, D, CS, DS>, FramebufferError>
where Self::Backend: Framebuffer<D>, D: Dimensionable, CS: ColorSlot<Self::Backend, D>, DS: DepthStencilSlot<Self::Backend, D>,

Create a new framebuffer.

See the documentation of Framebuffer::new for further details.

Source

fn new_shader_stage<R>( &mut self, ty: StageType, src: R, ) -> Result<Stage<Self::Backend>, StageError>
where Self::Backend: Shader, R: AsRef<str>,

Create a new shader stage.

See the documentation of Stage::new for further details.

Source

fn new_shader_program<Sem, Out, Uni>( &mut self, ) -> ProgramBuilder<'_, Self, Sem, Out, Uni>
where Self::Backend: Shader, Sem: Semantics,

Create a new shader program.

See the documentation of ProgramBuilder::new for further details.

Source

fn new_shader_data<T>( &mut self, values: impl IntoIterator<Item = T>, ) -> Result<ShaderData<Self::Backend, T>, ShaderDataError>
where Self::Backend: ShaderData<T>,

Create a new shader data.

See the documentation of ShaderData::new for further details.

Source

fn new_tess(&mut self) -> TessBuilder<'_, Self::Backend, ()>
where Self::Backend: Tess<(), (), (), Interleaved>,

Create a TessBuilder.

See the documentation of TessBuilder::new for further details.

Source

fn new_deinterleaved_tess<V, W>( &mut self, ) -> TessBuilder<'_, Self::Backend, V, (), W, Deinterleaved>

Create a TessBuilder with deinterleaved memory.

See the documentation of TessBuilder::new for further details.

Source

fn new_texture<D, P>( &mut self, size: <D as Dimensionable>::Size, sampler: Sampler, texels: TexelUpload<'_, [<P as Pixel>::Encoding]>, ) -> Result<Texture<Self::Backend, D, P>, TextureError>
where Self::Backend: Texture<D, P>, D: Dimensionable, P: Pixel,

Create a new texture from texels.

Feel free to have a look at the documentation of Texture::new for further details.

Source

fn new_texture_raw<D, P>( &mut self, size: <D as Dimensionable>::Size, sampler: Sampler, texels: TexelUpload<'_, [<P as Pixel>::RawEncoding]>, ) -> Result<Texture<Self::Backend, D, P>, TextureError>
where Self::Backend: Texture<D, P>, D: Dimensionable, P: Pixel,

Create a new texture from raw texels.

Feel free to have a look at the documentation of Texture::new_raw for further details.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§