mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
PipelineLayout::{as, from}_core
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
6b7954f1c7
commit
fc90a3b239
2 files changed
+34
No files matched your search
@@ -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`].
|
||||
|
||||
@@ -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>,
|
||||
|
||||
Reference in new issue
Block a user