Trait gfx::traits::FactoryExt
source · pub trait FactoryExt<R: Resources>: Factory<R> {
Show 15 methods
// Provided methods
fn create_vertex_buffer<T>(&mut self, vertices: &[T]) -> Buffer<R, T>
where T: Pod + Structure<Format> { ... }
fn create_index_buffer<T>(&mut self, indices: T) -> IndexBuffer<R>
where T: IntoIndexBuffer<R> { ... }
fn create_vertex_buffer_with_slice<B, V>(
&mut self,
vertices: &[V],
indices: B
) -> (Buffer<R, V>, Slice<R>)
where V: Pod + Structure<Format>,
B: IntoIndexBuffer<R> { ... }
fn create_constant_buffer<T>(&mut self, num: usize) -> Buffer<R, T>
where T: Copy { ... }
fn create_upload_buffer<T>(
&mut self,
num: usize
) -> Result<Buffer<R, T>, CreationError> { ... }
fn create_download_buffer<T>(
&mut self,
num: usize
) -> Result<Buffer<R, T>, CreationError> { ... }
fn create_shader_set(
&mut self,
vs_code: &[u8],
ps_code: &[u8]
) -> Result<ShaderSet<R>, ProgramError> { ... }
fn create_shader_set_geometry(
&mut self,
vs_code: &[u8],
gs_code: &[u8],
ps_code: &[u8]
) -> Result<ShaderSet<R>, ProgramError> { ... }
fn create_shader_set_tessellation(
&mut self,
vs_code: &[u8],
hs_code: &[u8],
ds_code: &[u8],
ps_code: &[u8]
) -> Result<ShaderSet<R>, ProgramError> { ... }
fn create_shader_set_tessellation_with_geometry(
&mut self,
vs_code: &[u8],
hs_code: &[u8],
ds_code: &[u8],
gs_code: &[u8],
ps_code: &[u8]
) -> Result<ShaderSet<R>, ProgramError> { ... }
fn link_program(
&mut self,
vs_code: &[u8],
ps_code: &[u8]
) -> Result<Program<R>, ProgramError> { ... }
fn create_pipeline_state<I: PipelineInit>(
&mut self,
shaders: &ShaderSet<R>,
primitive: Primitive,
rasterizer: Rasterizer,
init: I
) -> Result<PipelineState<R, I::Meta>, PipelineStateError<String>> { ... }
fn create_pipeline_from_program<'a, I: PipelineInit>(
&mut self,
program: &'a Program<R>,
primitive: Primitive,
rasterizer: Rasterizer,
init: I
) -> Result<PipelineState<R, I::Meta>, PipelineStateError<&'a str>> { ... }
fn create_pipeline_simple<I: PipelineInit>(
&mut self,
vs: &[u8],
ps: &[u8],
init: I
) -> Result<PipelineState<R, I::Meta>, PipelineStateError<String>> { ... }
fn create_sampler_linear(&mut self) -> Sampler<R> { ... }
}
Expand description
This trait is responsible for creating and managing graphics resources, much like the Factory
trait in the gfx
crate. Every Factory
automatically implements FactoryExt
.
Provided Methods§
sourcefn create_vertex_buffer<T>(&mut self, vertices: &[T]) -> Buffer<R, T>where
T: Pod + Structure<Format>,
fn create_vertex_buffer<T>(&mut self, vertices: &[T]) -> Buffer<R, T>where T: Pod + Structure<Format>,
Creates an immutable vertex buffer from the supplied vertices.
A Slice
will have to manually be constructed.
sourcefn create_index_buffer<T>(&mut self, indices: T) -> IndexBuffer<R>where
T: IntoIndexBuffer<R>,
fn create_index_buffer<T>(&mut self, indices: T) -> IndexBuffer<R>where T: IntoIndexBuffer<R>,
sourcefn create_vertex_buffer_with_slice<B, V>(
&mut self,
vertices: &[V],
indices: B
) -> (Buffer<R, V>, Slice<R>)where
V: Pod + Structure<Format>,
B: IntoIndexBuffer<R>,
fn create_vertex_buffer_with_slice<B, V>( &mut self, vertices: &[V], indices: B ) -> (Buffer<R, V>, Slice<R>)where V: Pod + Structure<Format>, B: IntoIndexBuffer<R>,
Creates an immutable vertex buffer from the supplied vertices,
together with a Slice
from the supplied indices.
sourcefn create_constant_buffer<T>(&mut self, num: usize) -> Buffer<R, T>where
T: Copy,
fn create_constant_buffer<T>(&mut self, num: usize) -> Buffer<R, T>where T: Copy,
Creates a constant buffer for num
identical elements of type T
.
sourcefn create_upload_buffer<T>(
&mut self,
num: usize
) -> Result<Buffer<R, T>, CreationError>
fn create_upload_buffer<T>( &mut self, num: usize ) -> Result<Buffer<R, T>, CreationError>
Creates an upload buffer for num
elements of type T
.
sourcefn create_download_buffer<T>(
&mut self,
num: usize
) -> Result<Buffer<R, T>, CreationError>
fn create_download_buffer<T>( &mut self, num: usize ) -> Result<Buffer<R, T>, CreationError>
Creates a download buffer for num
elements of type T
.
sourcefn create_shader_set(
&mut self,
vs_code: &[u8],
ps_code: &[u8]
) -> Result<ShaderSet<R>, ProgramError>
fn create_shader_set( &mut self, vs_code: &[u8], ps_code: &[u8] ) -> Result<ShaderSet<R>, ProgramError>
Creates a ShaderSet
from the supplied vertex and pixel shader source code.
sourcefn create_shader_set_geometry(
&mut self,
vs_code: &[u8],
gs_code: &[u8],
ps_code: &[u8]
) -> Result<ShaderSet<R>, ProgramError>
fn create_shader_set_geometry( &mut self, vs_code: &[u8], gs_code: &[u8], ps_code: &[u8] ) -> Result<ShaderSet<R>, ProgramError>
Creates a ShaderSet
from the supplied vertex, geometry, and pixel
shader source code. Mainly used for testing.
sourcefn create_shader_set_tessellation(
&mut self,
vs_code: &[u8],
hs_code: &[u8],
ds_code: &[u8],
ps_code: &[u8]
) -> Result<ShaderSet<R>, ProgramError>
fn create_shader_set_tessellation( &mut self, vs_code: &[u8], hs_code: &[u8], ds_code: &[u8], ps_code: &[u8] ) -> Result<ShaderSet<R>, ProgramError>
Creates a ShaderSet
from the supplied vertex, hull, domain, and pixel
shader source code. Mainly used for testing.
sourcefn create_shader_set_tessellation_with_geometry(
&mut self,
vs_code: &[u8],
hs_code: &[u8],
ds_code: &[u8],
gs_code: &[u8],
ps_code: &[u8]
) -> Result<ShaderSet<R>, ProgramError>
fn create_shader_set_tessellation_with_geometry( &mut self, vs_code: &[u8], hs_code: &[u8], ds_code: &[u8], gs_code: &[u8], ps_code: &[u8] ) -> Result<ShaderSet<R>, ProgramError>
Creates a ShaderSet
from the supplied vertex, hull, domain, geometry and pixel
shader source code. Mainly used for testing.
sourcefn link_program(
&mut self,
vs_code: &[u8],
ps_code: &[u8]
) -> Result<Program<R>, ProgramError>
fn link_program( &mut self, vs_code: &[u8], ps_code: &[u8] ) -> Result<Program<R>, ProgramError>
Creates a basic shader Program
from the supplied vertex and pixel shader source code.
sourcefn create_pipeline_state<I: PipelineInit>(
&mut self,
shaders: &ShaderSet<R>,
primitive: Primitive,
rasterizer: Rasterizer,
init: I
) -> Result<PipelineState<R, I::Meta>, PipelineStateError<String>>
fn create_pipeline_state<I: PipelineInit>( &mut self, shaders: &ShaderSet<R>, primitive: Primitive, rasterizer: Rasterizer, init: I ) -> Result<PipelineState<R, I::Meta>, PipelineStateError<String>>
Similar to create_pipeline_from_program(..)
, but takes a ShaderSet
as opposed to a
shader Program
.
sourcefn create_pipeline_from_program<'a, I: PipelineInit>(
&mut self,
program: &'a Program<R>,
primitive: Primitive,
rasterizer: Rasterizer,
init: I
) -> Result<PipelineState<R, I::Meta>, PipelineStateError<&'a str>>
fn create_pipeline_from_program<'a, I: PipelineInit>( &mut self, program: &'a Program<R>, primitive: Primitive, rasterizer: Rasterizer, init: I ) -> Result<PipelineState<R, I::Meta>, PipelineStateError<&'a str>>
Creates a strongly typed PipelineState
from its Init
structure, a shader Program
, a
primitive type and a Rasterizer
.
sourcefn create_pipeline_simple<I: PipelineInit>(
&mut self,
vs: &[u8],
ps: &[u8],
init: I
) -> Result<PipelineState<R, I::Meta>, PipelineStateError<String>>
fn create_pipeline_simple<I: PipelineInit>( &mut self, vs: &[u8], ps: &[u8], init: I ) -> Result<PipelineState<R, I::Meta>, PipelineStateError<String>>
Creates a strongly typed PipelineState
from its Init
structure. Automatically creates a
shader Program
from a vertex and pixel shader source, as well as a Rasterizer
capable
of rendering triangle faces without culling.
sourcefn create_sampler_linear(&mut self) -> Sampler<R>
fn create_sampler_linear(&mut self) -> Sampler<R>
Create a linear sampler with clamping to border.