use core::num::NonZeroU32;
use crate::*;
#[derive(Debug, Clone)]
pub struct RenderPipeline {
pub(crate) inner: dispatch::DispatchRenderPipeline,
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(RenderPipeline: Send, Sync);
crate::cmp::impl_eq_ord_hash_proxy!(RenderPipeline => .inner);
impl RenderPipeline {
pub fn get_bind_group_layout(&self, index: u32) -> BindGroupLayout {
let layout = self.inner.get_bind_group_layout(index);
BindGroupLayout { inner: layout }
}
#[cfg(custom)]
pub fn as_custom<T: custom::RenderPipelineInterface>(&self) -> Option<&T> {
self.inner.as_custom()
}
}
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
pub struct VertexBufferLayout<'a> {
pub array_stride: BufferAddress,
pub step_mode: VertexStepMode,
pub attributes: &'a [VertexAttribute],
}
static_assertions::assert_impl_all!(VertexBufferLayout<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct VertexState<'a> {
pub module: &'a ShaderModule,
pub entry_point: Option<&'a str>,
pub compilation_options: PipelineCompilationOptions<'a>,
pub buffers: &'a [VertexBufferLayout<'a>],
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(VertexState<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct FragmentState<'a> {
pub module: &'a ShaderModule,
pub entry_point: Option<&'a str>,
pub compilation_options: PipelineCompilationOptions<'a>,
pub targets: &'a [Option<ColorTargetState>],
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(FragmentState<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct TaskState<'a> {
pub module: &'a ShaderModule,
pub entry_point: Option<&'a str>,
pub compilation_options: PipelineCompilationOptions<'a>,
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(TaskState<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct MeshState<'a> {
pub module: &'a ShaderModule,
pub entry_point: Option<&'a str>,
pub compilation_options: PipelineCompilationOptions<'a>,
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(MeshState<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct RenderPipelineDescriptor<'a> {
pub label: Label<'a>,
pub layout: Option<&'a PipelineLayout>,
pub vertex: VertexState<'a>,
pub primitive: PrimitiveState,
pub depth_stencil: Option<DepthStencilState>,
pub multisample: MultisampleState,
pub fragment: Option<FragmentState<'a>>,
pub multiview: Option<NonZeroU32>,
pub cache: Option<&'a PipelineCache>,
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(RenderPipelineDescriptor<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct MeshPipelineDescriptor<'a> {
pub label: Label<'a>,
pub layout: Option<&'a PipelineLayout>,
pub task: Option<TaskState<'a>>,
pub mesh: MeshState<'a>,
pub primitive: PrimitiveState,
pub depth_stencil: Option<DepthStencilState>,
pub multisample: MultisampleState,
pub fragment: Option<FragmentState<'a>>,
pub multiview: Option<NonZeroU32>,
pub cache: Option<&'a PipelineCache>,
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(MeshPipelineDescriptor<'_>: Send, Sync);