RenderPipeline::{as, from}_core

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev authored and mergify[bot] committed 2026-09-27 06:46:29 +00:00
1 parent a9169d0295
commit 988891de66
2 files changed
+34

No files matched your search

+22
View File
@@ -36,6 +36,28 @@ impl RenderPipeline {
}
}
#[cfg(wgpu_core)]
impl RenderPipeline {
/// Create a new render pipeline of wgpu from a wgpu-core render pipeline.
///
/// # Arguments
///
/// - `core_render_pipeline` - wgpu-core render pipeline.
pub fn from_core(
core_render_pipeline: alloc::sync::Arc<wgc::pipeline::RenderPipeline>,
) -> Self {
Self {
inner: crate::backend::wgpu_core::CoreRenderPipeline::from_core(core_render_pipeline)
.into(),
}
}
/// Returns the underlying wgpu-core render pipeline if this `RenderPipeline` is on the wgpu-core backend, otherwise `None`.
pub fn as_core(&self) -> Option<alloc::sync::Arc<wgc::pipeline::RenderPipeline>> {
self.inner.as_core_opt().map(|rp| rp.as_core())
}
}
/// Specifies an interpretation of the bytes of a vertex buffer as vertex attributes.
///
/// Use this in a [`RenderPipelineDescriptor`] to describe the format of the vertex buffers that
+12
View File
@@ -554,6 +554,18 @@ pub struct CoreRenderPipeline {
pub(crate) wgpu_render_pipeline: Arc<wgc::pipeline::RenderPipeline>,
}
impl CoreRenderPipeline {
pub(crate) fn from_core(core_render_pipeline: Arc<wgc::pipeline::RenderPipeline>) -> Self {
Self {
wgpu_render_pipeline: core_render_pipeline,
}
}
pub(crate) fn as_core(&self) -> Arc<wgc::pipeline::RenderPipeline> {
self.wgpu_render_pipeline.clone()
}
}
#[derive(Debug)]
pub struct CoreComputePass {
pass: wgc::command::ComputePass,