PipelineLayout::{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 6b7954f1c7
commit fc90a3b239
2 files changed
+34

No files matched your search

+22
View File
@@ -23,6 +23,28 @@ impl PipelineLayout {
}
}
#[cfg(wgpu_core)]
impl PipelineLayout {
/// Create a new pipeline layout of wgpu from a wgpu-core pipeline layout.
///
/// # Arguments
///
/// - `core_pipeline_layout` - wgpu-core pipeline layout.
pub fn from_core(
core_pipeline_layout: alloc::sync::Arc<wgc::binding_model::PipelineLayout>,
) -> Self {
Self {
inner: crate::backend::wgpu_core::CorePipelineLayout::from_core(core_pipeline_layout)
.into(),
}
}
/// Returns the underlying wgpu-core pipeline layout if this `PipelineLayout` is on the wgpu-core backend, otherwise `None`.
pub fn as_core(&self) -> Option<alloc::sync::Arc<wgc::binding_model::PipelineLayout>> {
self.inner.as_core_opt().map(|pl| pl.as_core())
}
}
/// Describes a [`PipelineLayout`].
///
/// For use with [`Device::create_pipeline_layout`].
+12
View File
@@ -436,6 +436,18 @@ pub struct CorePipelineLayout {
pub(crate) wgpu_pipeline_layout: Arc<wgc::binding_model::PipelineLayout>,
}
impl CorePipelineLayout {
pub(crate) fn from_core(core_pipeline_layout: Arc<wgc::binding_model::PipelineLayout>) -> Self {
Self {
wgpu_pipeline_layout: core_pipeline_layout,
}
}
pub(crate) fn as_core(&self) -> Arc<wgc::binding_model::PipelineLayout> {
self.wgpu_pipeline_layout.clone()
}
}
#[derive(Debug, Clone)]
pub struct CorePipelineCache {
pub(crate) wgpu_pipeline_cache: Arc<wgc::pipeline::PipelineCache>,