mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-28 00:59:12 +01:00
ComputePipeline::{as, from}_core
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
1 parent
f7ae2007a0
commit
6b7954f1c7
2 files changed
+34
No files matched your search
@@ -35,6 +35,28 @@ impl ComputePipeline {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(wgpu_core)]
|
||||
impl ComputePipeline {
|
||||
/// Create a new compute pipeline of wgpu from a wgpu-core compute pipeline.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// - `core_compute_pipeline` - wgpu-core compute pipeline.
|
||||
pub fn from_core(
|
||||
core_compute_pipeline: alloc::sync::Arc<wgc::pipeline::ComputePipeline>,
|
||||
) -> Self {
|
||||
Self {
|
||||
inner: crate::backend::wgpu_core::CoreComputePipeline::from_core(core_compute_pipeline)
|
||||
.into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the underlying wgpu-core compute pipeline if this `ComputePipeline` is on the wgpu-core backend, otherwise `None`.
|
||||
pub fn as_core(&self) -> Option<alloc::sync::Arc<wgc::pipeline::ComputePipeline>> {
|
||||
self.inner.as_core_opt().map(|cp| cp.as_core())
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a compute pipeline.
|
||||
///
|
||||
/// For use with [`Device::create_compute_pipeline`].
|
||||
|
||||
@@ -513,6 +513,18 @@ pub struct CoreComputePipeline {
|
||||
pub(crate) wgpu_compute_pipeline: Arc<wgc::pipeline::ComputePipeline>,
|
||||
}
|
||||
|
||||
impl CoreComputePipeline {
|
||||
pub(crate) fn from_core(core_compute_pipeline: Arc<wgc::pipeline::ComputePipeline>) -> Self {
|
||||
Self {
|
||||
wgpu_compute_pipeline: core_compute_pipeline,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn as_core(&self) -> Arc<wgc::pipeline::ComputePipeline> {
|
||||
self.wgpu_compute_pipeline.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CoreRenderPipeline {
|
||||
pub(crate) wgpu_render_pipeline: Arc<wgc::pipeline::RenderPipeline>,
|
||||
|
||||
Reference in new issue
Block a user