[−][src]Struct web_glitz::pipeline::graphics::GraphicsPipelineDescriptorBuilder
Type checked builder for a GraphicsPipelineDescriptor.
The following behaviours of the graphics pipeline can be configured:
- The vertex shader stage can be specified with [vertex_shader]. See VertexShader for details on the vertex shader stage. Must be set explicitly, has no default value.
- The primitive assembly shader stage can be specified with [primitive_assembly]. See PrimitiveAssembly on the primitive assembly stage. Must be set explicitly, has no default value.
- The fragment shader stage can be specified with [fragment_shader]. See FragmentShader for details on the fragment shader stage. Must be set explicitly, has no default value.
- The vertex input layout may be specified with [typed_vertex_input_layout] or
[untyped_vertex_input_layout]. Defaults to the (typed) empty vertex input layout
(). - The resource bindings layout may be specified with [typed_resource_bindings_layout] or
[untyped_resource_bindings_layout]. Defaults to the (typed) empty resource bindings layout
(). - The transform feedback layout may be specified with [typed_transform_feedback_layout] or
[untyped_transform_feedback_layout]. Defaults to the (typed) empty transform feedback layout
(). - The depth test can be enabled with [enable_depth_test]. See DepthTest for details on the depth test. If not set explicitly, will default to disabled.
- The stencil test can be enabled with [enable_stencil_test]. See StencilTest for details on the stencil test. If not set explicitly, will default to disabled.
- A scissor region may be specified with [scissor_region]. Any fragments outside the scissor region will be discarded before the fragment processing stages. If not set explicitly, the the scissor region defaults to Region2D::Fill and will match the size of the framebuffer that is the current draw target.
- Blending can be enabled with [enable_blending]. See Blending for details on blending. If not set explicitly, will default to disabled.
- The viewport may be specified with [viewport]. See Viewport for details on the viewport. If no viewport is explicitly specified, then the viewport will default to Viewport::Auto.
Finally, the GraphicsPipelineDescriptor may be finalized by calling [finish]. [finish] may only be called if at least the following have been explicitly specified:
- The vertex shader with [vertex_shader].
- The primitive assembly algorithm with [primitive_assembly].
- The fragment shader with [fragment_shader].
Example
use web_glitz::pipeline::graphics::{ GraphicsPipelineDescriptor, PrimitiveAssembly, WindingOrder, CullingMode, DepthTest }; let graphics_pipeline_descriptor = GraphicsPipelineDescriptor::begin() .vertex_shader(&vertex_shader) .primitive_assembly(PrimitiveAssembly::Triangles { winding_order: WindingOrder::CounterClockwise, face_culling: CullingMode::None }) .fragment_shader(&fragment_shader) .enable_depth_test(DepthTest::default()) .typed_vertex_attribute_layout::<MyVertex>() .typed_resource_bindings_layout::<MyResources>() .finish();
Here vertex_shader is a VertexShader, fragment_shader is a FragmentShader, MyVertex is
a type that implements TypedVertexInputLayout and MyResources is a type that
implements TypedResourceBindingsLayout.
Implementations
impl<Vs, Pa, Fs, V, R, Tf> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, Tf>[src]
pub fn vertex_shader(
self,
vertex_shader: &VertexShader
) -> GraphicsPipelineDescriptorBuilder<VertexShader, Pa, Fs, V, R, Tf>[src]
self,
vertex_shader: &VertexShader
) -> GraphicsPipelineDescriptorBuilder<VertexShader, Pa, Fs, V, R, Tf>
Specifies the VertexShader that any graphics pipeline created using the descriptor will use.
See VertexShader for details on vertex shaders.
pub fn primitive_assembly(
self,
primitive_assembly: PrimitiveAssembly
) -> GraphicsPipelineDescriptorBuilder<Vs, PrimitiveAssembly, Fs, V, R, Tf>[src]
self,
primitive_assembly: PrimitiveAssembly
) -> GraphicsPipelineDescriptorBuilder<Vs, PrimitiveAssembly, Fs, V, R, Tf>
Specifies the PrimitiveAssembly algorithm that any graphics pipeline created using the descriptor will use.
See PrimitiveAssembly for details on primitive assembly.
pub fn fragment_shader(
self,
fragment_shader: &FragmentShader
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, FragmentShader, V, R, Tf>[src]
self,
fragment_shader: &FragmentShader
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, FragmentShader, V, R, Tf>
Specifies the FragmentShader that any graphics pipeline created using the descriptor will use.
See FragmentShader for details on fragment shaders.
pub fn typed_vertex_attribute_layout<T>(
self
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, T, R, Tf> where
T: TypedVertexInputLayout, [src]
self
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, T, R, Tf> where
T: TypedVertexInputLayout,
Specifies a [TypedVertexAttributeLayout] type that determines the vertex input layout for any graphics pipeline created from the descriptor.
When the descriptor that results from this builder is used to create a graphics pipeline (see [RenderingContext::create_graphics_pipeline]), the vertex input layout associated with this type is checked against the actual vertex input layout defined by the pipeline's programmable shader stages (by reflecting on the code for these shader stages). If the layout defined by this type and the actual layout defined by the shader stages do not match, then pipeline creation will fail and an error is returned instead. If the layouts do match, then vertex input streams that use the type as their vertex type may be safely bound to the pipeline when creating draw commands without additional runtime checks (see [PipelineTask::draw_command]).
Note that [TypedVertexAttributeLayout] is implemented for any type that implements [Vertex]
and any tuple of types that implement [Vertex] (e.g. (Vertex1, Vertex2) where both
Vertex1 and Vertex2 are types that implement [Vertex]).
pub fn untyped_vertex_attribute_layout(
self,
vertex_attribute_layout: VertexInputLayoutDescriptor
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, Untyped, R, Tf>[src]
self,
vertex_attribute_layout: VertexInputLayoutDescriptor
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, Untyped, R, Tf>
pub fn typed_transform_feedback_layout<T>(
self
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, T> where
T: TypedTransformFeedbackLayout, [src]
self
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, T> where
T: TypedTransformFeedbackLayout,
Specifies a TypedTransformFeedbackLayout type that determines the layout of the transform feedback produced by any pipeline created using this descriptor.
When the descriptor that results from this builder is used to create a graphics pipeline (see [RenderingContext::create_graphics_pipeline]), the transform feedback layout associated with this type is checked against the actual transform feedback layout defined by the pipeline's programmable shader stages (by reflecting on the code for these shader stages). If the layout defined by this type and the actual layout defined by the shader stages do not match, then pipeline creation will fail and an error is returned instead. If the layouts do match, then [TypedTransformFeedbackBuffers] that match the layout may be safely bound to the pipeline without additional runtime checks (see [GraphicsPipeline::record_transform_feedback]).
Note that TypedTransformFeedbackLayout is implemented for any type that implements
[TransformFeedback] and any tuple of types that implement [TransformFeedback] (e.g.
(TransformFeedback1, TransformFeedback2) where both TransformFeedback1 and
TransformFeedback2 are types that implement [TransformFeedback]).
pub fn untyped_transform_feedback_layout(
self,
transform_feedback_layout: TransformFeedbackLayoutDescriptor
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, Untyped>[src]
self,
transform_feedback_layout: TransformFeedbackLayoutDescriptor
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, Untyped>
pub fn typed_resource_bindings_layout<T>(
self
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, T, Tf> where
T: TypedResourceBindingsLayout, [src]
self
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, T, Tf> where
T: TypedResourceBindingsLayout,
Specifies a TypedResourceBindingsLayout type that determines the resource bindings layout for any graphics pipeline created from the descriptor.
When the descriptor that results from this builder is used to create a graphics pipeline (see [RenderingContext::create_graphics_pipeline]), the resource layout associated with this type is checked against the actual resource layout defined by the pipeline's programmable shader stages (by reflecting on the code for these shader stages). If the layout defined by this type and the actual layout defined by the shader stages do not match, then pipeline creation will fail and an error is returned instead. If the layouts do match, then instances of this type may be safely bound to the pipeline's resource slots when creating pipeline tasks draw commands without additional runtime checks (see [PipelineTaskBuilder::bind_resources]).
Note that TypedResourceBindingsLayout is implemented for any type that derives [Resources].
pub fn untyped_resource_bindings_layout(
self,
layout: ResourceBindingsLayoutDescriptor
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, Untyped, Tf>[src]
self,
layout: ResourceBindingsLayoutDescriptor
) -> GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, Untyped, Tf>
pub fn enable_depth_test(self, depth_test: DepthTest) -> Self[src]
Enables the depth test for any graphics pipeline created from the descriptor.
See DepthTest for details on the depth test.
pub fn enable_stencil_test(self, stencil_test: StencilTest) -> Self[src]
Enables the depth test for any graphics pipeline created from the descriptor.
See StencilTest for details on the depth test.
pub fn scissor_region(self, scissor_region: Region2D) -> Self[src]
Sets the scissor region used by any graphics pipeline created from the descriptor.
Any fragments outside the scissor region will be discarded before the fragment processing stages. If not set explicitly, the scissor region defaults to Region2D::Fill and will match the size of the framebuffer that is the current draw target.
pub fn enable_blending(self, blending: Blending) -> Self[src]
Enables blending for any graphics pipeline created from the descriptor.
See Blending for details on blending.
pub fn viewport(self, viewport: Viewport) -> Self[src]
Sets the viewport used by any graphics pipeline created from the descriptor.
See Viewport for details on the viewport. Defaults to Viewport::Auto.
impl<V, R, Tf> GraphicsPipelineDescriptorBuilder<VertexShader, PrimitiveAssembly, FragmentShader, V, R, Tf>[src]
pub fn finish(self) -> GraphicsPipelineDescriptor<V, R, Tf>[src]
Finishes building and returns the GraphicsPipelineDescriptor.
Auto Trait Implementations
impl<Vs, Pa, Fs, V, R, Tf> !RefUnwindSafe for GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, Tf>
impl<Vs, Pa, Fs, V, R, Tf> !Send for GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, Tf>
impl<Vs, Pa, Fs, V, R, Tf> !Sync for GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, Tf>
impl<Vs, Pa, Fs, V, R, Tf> Unpin for GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, Tf> where
Fs: Unpin,
Pa: Unpin,
R: Unpin,
Tf: Unpin,
V: Unpin,
Vs: Unpin,
Fs: Unpin,
Pa: Unpin,
R: Unpin,
Tf: Unpin,
V: Unpin,
Vs: Unpin,
impl<Vs, Pa, Fs, V, R, Tf> !UnwindSafe for GraphicsPipelineDescriptorBuilder<Vs, Pa, Fs, V, R, Tf>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<D, T> IntoBuffer<T> for D where
D: Borrow<T> + 'static,
T: Copy + 'static, [src]
D: Borrow<T> + 'static,
T: Copy + 'static,
fn into_buffer<Rc>(Self, &Rc, BufferId, UsageHint) -> Buffer<T> where
Rc: RenderingContext + Clone + 'static, [src]
Rc: RenderingContext + Clone + 'static,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,