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
91 lines
1.8 KiB
Rust
91 lines
1.8 KiB
Rust
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
|
|
use deno_core::GarbageCollected;
|
|
use deno_core::WebIDL;
|
|
use deno_core::op2;
|
|
use deno_core::webidl::WebIdlInterfaceConverter;
|
|
use deno_error::JsErrorBox;
|
|
|
|
use crate::Instance;
|
|
|
|
pub struct GPUQuerySet {
|
|
pub instance: Instance,
|
|
pub id: wgpu_core::id::QuerySetId,
|
|
pub r#type: GPUQueryType,
|
|
pub count: u32,
|
|
pub label: String,
|
|
}
|
|
|
|
impl Drop for GPUQuerySet {
|
|
fn drop(&mut self) {
|
|
self.instance.query_set_drop(self.id);
|
|
}
|
|
}
|
|
|
|
impl WebIdlInterfaceConverter for GPUQuerySet {
|
|
const NAME: &'static str = "GPUQuerySet";
|
|
}
|
|
|
|
impl GarbageCollected for GPUQuerySet {
|
|
fn get_name(&self) -> &'static std::ffi::CStr {
|
|
c"GPUQuerySet"
|
|
}
|
|
}
|
|
|
|
#[op2]
|
|
impl GPUQuerySet {
|
|
#[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
|
|
}
|
|
|
|
#[fast]
|
|
fn destroy(&self) -> Result<(), JsErrorBox> {
|
|
Err(JsErrorBox::generic(
|
|
"This operation is currently not supported",
|
|
))
|
|
}
|
|
|
|
#[getter]
|
|
#[string]
|
|
fn r#type(&self) -> &'static str {
|
|
self.r#type.as_str()
|
|
}
|
|
|
|
#[getter]
|
|
fn count(&self) -> u32 {
|
|
self.count
|
|
}
|
|
}
|
|
|
|
#[derive(WebIDL)]
|
|
#[webidl(dictionary)]
|
|
pub(crate) struct GPUQuerySetDescriptor {
|
|
#[webidl(default = String::new())]
|
|
pub label: String,
|
|
|
|
pub r#type: GPUQueryType,
|
|
#[options(enforce_range = true)]
|
|
pub count: u32,
|
|
}
|
|
|
|
#[derive(WebIDL, Clone)]
|
|
#[webidl(enum)]
|
|
pub(crate) enum GPUQueryType {
|
|
Occlusion,
|
|
Timestamp,
|
|
}
|
|
impl From<GPUQueryType> for wgpu_types::QueryType {
|
|
fn from(value: GPUQueryType) -> Self {
|
|
match value {
|
|
GPUQueryType::Occlusion => Self::Occlusion,
|
|
GPUQueryType::Timestamp => Self::Timestamp,
|
|
}
|
|
}
|
|
}
|