mirror of
https://github.com/denoland/deno.git
synced 2025-07-07 21:35:07 +00:00

Some checks are pending
ci / publish canary (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
86 lines
2 KiB
Rust
86 lines
2 KiB
Rust
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
|
|
use deno_core::GarbageCollected;
|
|
use deno_core::WebIDL;
|
|
use deno_core::cppgc::Ptr;
|
|
use deno_core::op2;
|
|
use deno_core::webidl::WebIdlInterfaceConverter;
|
|
use indexmap::IndexMap;
|
|
|
|
use crate::Instance;
|
|
use crate::bind_group_layout::GPUBindGroupLayout;
|
|
use crate::shader::GPUShaderModule;
|
|
use crate::webidl::GPUPipelineLayoutOrGPUAutoLayoutMode;
|
|
|
|
pub struct GPUComputePipeline {
|
|
pub instance: Instance,
|
|
pub error_handler: super::error::ErrorHandler,
|
|
|
|
pub id: wgpu_core::id::ComputePipelineId,
|
|
pub label: String,
|
|
}
|
|
|
|
impl Drop for GPUComputePipeline {
|
|
fn drop(&mut self) {
|
|
self.instance.compute_pipeline_drop(self.id);
|
|
}
|
|
}
|
|
|
|
impl WebIdlInterfaceConverter for GPUComputePipeline {
|
|
const NAME: &'static str = "GPUComputePipeline";
|
|
}
|
|
|
|
impl GarbageCollected for GPUComputePipeline {
|
|
fn get_name(&self) -> &'static std::ffi::CStr {
|
|
c"GPUComputePipeline"
|
|
}
|
|
}
|
|
|
|
#[op2]
|
|
impl GPUComputePipeline {
|
|
#[getter]
|
|
#[string]
|
|
fn label(&self) -> String {
|
|
self.label.clone()
|
|
}
|
|
#[setter]
|
|
#[string]
|
|
fn label(&self, #[webidl] _label: String) {
|
|
// TODO(@crowlKats): no-op, needs wpgu to implement changing the label
|
|
}
|
|
|
|
#[cppgc]
|
|
fn get_bind_group_layout(&self, #[webidl] index: u32) -> GPUBindGroupLayout {
|
|
let (id, err) = self
|
|
.instance
|
|
.compute_pipeline_get_bind_group_layout(self.id, index, None);
|
|
|
|
self.error_handler.push_error(err);
|
|
|
|
// TODO(wgpu): needs to support retrieving the label
|
|
GPUBindGroupLayout {
|
|
instance: self.instance.clone(),
|
|
id,
|
|
label: "".to_string(),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(WebIDL)]
|
|
#[webidl(dictionary)]
|
|
pub(crate) struct GPUComputePipelineDescriptor {
|
|
#[webidl(default = String::new())]
|
|
pub label: String,
|
|
|
|
pub compute: GPUProgrammableStage,
|
|
pub layout: GPUPipelineLayoutOrGPUAutoLayoutMode,
|
|
}
|
|
|
|
#[derive(WebIDL)]
|
|
#[webidl(dictionary)]
|
|
pub(crate) struct GPUProgrammableStage {
|
|
pub module: Ptr<GPUShaderModule>,
|
|
pub entry_point: Option<String>,
|
|
#[webidl(default = Default::default())]
|
|
pub constants: IndexMap<String, f64>,
|
|
}
|