mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 00:03:29 +00:00
update deno (#3808)
This commit is contained in:
parent
4aff9b67af
commit
0ece5e6119
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -11,7 +11,7 @@ env:
|
||||
CARGO_INCREMENTAL: false
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: full
|
||||
MSRV: 1.64
|
||||
MSRV: 1.65
|
||||
PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work
|
||||
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
|
||||
RUSTDOCFLAGS: -Dwarnings
|
||||
|
2
.github/workflows/cts.yml
vendored
2
.github/workflows/cts.yml
vendored
@ -11,7 +11,7 @@ env:
|
||||
CARGO_INCREMENTAL: false
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: full
|
||||
MSRV: 1.64
|
||||
MSRV: 1.65
|
||||
|
||||
jobs:
|
||||
cts:
|
||||
|
116
Cargo.lock
generated
116
Cargo.lock
generated
@ -237,9 +237,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.2.1"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
||||
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||
|
||||
[[package]]
|
||||
name = "calloop"
|
||||
@ -562,18 +562,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deno_console"
|
||||
version = "0.92.0"
|
||||
version = "0.106.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55193bcb66a9a9830e1348280acbb9dd65c67d9a9a0586af9730079886408dce"
|
||||
checksum = "86e7857cc8b133aed57e5f1dcfac6c0db308e70540727dfe0637af5281299758"
|
||||
dependencies = [
|
||||
"deno_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deno_core"
|
||||
version = "0.174.0"
|
||||
version = "0.188.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8077367e7e7ab2f52f1bc6285af301a1a6328b984991a3ff22236ad79862fce3"
|
||||
checksum = "83573c39d4045b6c2e056a2ad87e49c43e57b64b54ee4381894c030390fa1f76"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
@ -590,16 +590,18 @@ dependencies = [
|
||||
"serde_v8",
|
||||
"smallvec",
|
||||
"sourcemap",
|
||||
"tokio",
|
||||
"url",
|
||||
"v8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deno_ops"
|
||||
version = "0.52.0"
|
||||
version = "0.66.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc9d81c9e5cd9590be6043546f4565670cb6e6a7de1986fd1c354adce04eb9d4"
|
||||
checksum = "0446caff6cdb14fbf6c5e85fc042e3102aa6c618fa19a2ef47b67fc2657c0e8e"
|
||||
dependencies = [
|
||||
"lazy-regex",
|
||||
"once_cell",
|
||||
"pmutil",
|
||||
"proc-macro-crate",
|
||||
@ -611,9 +613,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deno_url"
|
||||
version = "0.92.0"
|
||||
version = "0.106.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "906895a8ba4a95f48c51a32947061bf82f42da8f7c8df787012503f1a6042685"
|
||||
checksum = "eae0fa17e1fc70d8bb1f59d64a952b790afd774d3499524d7a760812eec07486"
|
||||
dependencies = [
|
||||
"deno_core",
|
||||
"serde",
|
||||
@ -623,9 +625,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deno_web"
|
||||
version = "0.123.0"
|
||||
version = "0.137.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af75e7ff90a3f719adc074a8789da16687b9e77a97d67eb727b65fae71262637"
|
||||
checksum = "a10df5503ffec0b1a59541e2587f84873676d714e5d935ecc4d2792685827198"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"base64-simd",
|
||||
@ -635,6 +637,7 @@ dependencies = [
|
||||
"serde",
|
||||
"tokio",
|
||||
"uuid",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -651,9 +654,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "deno_webidl"
|
||||
version = "0.92.0"
|
||||
version = "0.106.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "387a0cfb076580e0237ba6f1b338ee2688779c6a5e531d4a8a2a82b216917ae0"
|
||||
checksum = "980a92f4619ace414abd464ad417ae362c7be05020009dfd4c4f1794ed21c71f"
|
||||
dependencies = [
|
||||
"deno_core",
|
||||
]
|
||||
@ -1394,6 +1397,29 @@ version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
||||
|
||||
[[package]]
|
||||
name = "lazy-regex"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff63c423c68ea6814b7da9e88ce585f793c87ddd9e78f646970891769c8235d4"
|
||||
dependencies = [
|
||||
"lazy-regex-proc_macros",
|
||||
"once_cell",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy-regex-proc_macros"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8edfc11b8f56ce85e207e62ea21557cfa09bb24a8f6b04ae181b086ff8611c22"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"syn 1.0.105",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
@ -1641,7 +1667,7 @@ version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82051dd6745d5184c6efb7bc8be14892a7f6d4f3ad6dbf754d1c7d7d5fe24b43"
|
||||
dependencies = [
|
||||
"rand",
|
||||
"rand 0.7.3",
|
||||
"rand_xorshift",
|
||||
]
|
||||
|
||||
@ -1655,6 +1681,18 @@ dependencies = [
|
||||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-integer",
|
||||
"num-traits 0.2.15",
|
||||
"rand 0.8.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.45"
|
||||
@ -1997,10 +2035,19 @@ dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"rand_core 0.6.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.2.2"
|
||||
@ -2008,7 +2055,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2020,13 +2067,19 @@ dependencies = [
|
||||
"getrandom 0.1.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2035,7 +2088,7 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2296,15 +2349,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_v8"
|
||||
version = "0.85.0"
|
||||
version = "0.99.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dba78050262072324b0b1efba11db7367735251adf7ec734fd75780c598c743b"
|
||||
checksum = "abcb15f793aba70da4d29b2015c9b70943bd7f6970cab7963fcf83c19bbab1c9"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"derive_more",
|
||||
"num-bigint",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"v8",
|
||||
]
|
||||
|
||||
@ -2550,14 +2605,13 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.25.0"
|
||||
version = "1.28.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
|
||||
checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"parking_lot 0.12.1",
|
||||
@ -2565,18 +2619,18 @@ dependencies = [
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.42.0",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "1.8.2"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
|
||||
checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.105",
|
||||
"syn 2.0.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2711,13 +2765,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "v8"
|
||||
version = "0.64.0"
|
||||
version = "0.72.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2287b485fa902172da3722d7e557e083afd63921777e0c6e5c0fba28e6d59d3"
|
||||
checksum = "d5c1d09f66ab7f69e36211c5488d47f683fef6b65b83a627cfd75ed9cef254e6"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"fslock",
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
"which",
|
||||
]
|
||||
|
||||
|
12
Cargo.toml
12
Cargo.toml
@ -16,7 +16,7 @@ default-members = ["wgpu", "wgpu-hal", "wgpu-info", "wgpu-types"]
|
||||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
rust-version = "1.64"
|
||||
rust-version = "1.65"
|
||||
keywords = ["graphics"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
homepage = "https://wgpu.rs/"
|
||||
@ -122,11 +122,11 @@ wasm-bindgen-test = "0.3"
|
||||
web-sys = "0.3.61"
|
||||
|
||||
# deno dependencies
|
||||
deno_console = "0.92.0"
|
||||
deno_core = "0.174.0"
|
||||
deno_url = "0.92.0"
|
||||
deno_web = "0.123.0"
|
||||
deno_webidl = "0.92.0"
|
||||
deno_console = "0.106.0"
|
||||
deno_core = "0.188.0"
|
||||
deno_url = "0.106.0"
|
||||
deno_web = "0.137.0"
|
||||
deno_webidl = "0.106.0"
|
||||
deno_webgpu = { path = "./deno_webgpu" }
|
||||
tokio = "1.25.0"
|
||||
termcolor = "1.2.0"
|
||||
|
13
cts_runner/src/bootstrap.js
vendored
13
cts_runner/src/bootstrap.js
vendored
@ -23,12 +23,23 @@ import * as event from "ext:deno_web/02_event.js";
|
||||
import * as timers from "ext:deno_web/02_timers.js";
|
||||
import * as base64 from "ext:deno_web/05_base64.js";
|
||||
import * as encoding from "ext:deno_web/08_text_encoding.js";
|
||||
import { Console } from "ext:deno_console/02_console.js";
|
||||
import { Console } from "ext:deno_console/01_console.js";
|
||||
import * as url from "ext:deno_url/00_url.js";
|
||||
import DOMException from "ext:deno_web/01_dom_exception.js";
|
||||
import * as performance from "ext:deno_web/15_performance.js";
|
||||
import * as webgpu from "ext:deno_webgpu/01_webgpu.js";
|
||||
|
||||
// imports needed to pass module evaluation
|
||||
import "ext:deno_url/01_urlpattern.js";
|
||||
import "ext:deno_web/01_mimesniff.js";
|
||||
import "ext:deno_web/03_abort_signal.js";
|
||||
import "ext:deno_web/06_streams.js";
|
||||
import "ext:deno_web/09_file.js";
|
||||
import "ext:deno_web/10_filereader.js";
|
||||
import "ext:deno_web/12_location.js";
|
||||
import "ext:deno_web/13_message_port.js";
|
||||
import "ext:deno_web/14_compression.js";
|
||||
|
||||
let globalThis_;
|
||||
|
||||
const util = {
|
||||
|
@ -27,18 +27,18 @@ mod native {
|
||||
let url = args_iter
|
||||
.next()
|
||||
.ok_or_else(|| anyhow!("missing specifier in first command line argument"))?;
|
||||
let specifier = resolve_url_or_path(&url)?;
|
||||
let specifier = resolve_url_or_path(&url, &env::current_dir()?)?;
|
||||
|
||||
let options = RuntimeOptions {
|
||||
module_loader: Some(Rc::new(deno_core::FsModuleLoader)),
|
||||
get_error_class_fn: Some(&get_error_class_name),
|
||||
extensions: vec![
|
||||
deno_webidl::init_esm(),
|
||||
deno_console::init_esm(),
|
||||
deno_url::init_ops_and_esm(),
|
||||
deno_web::init_ops_and_esm::<Permissions>(BlobStore::default(), None),
|
||||
deno_webgpu::init_ops_and_esm(true),
|
||||
extension(),
|
||||
deno_webidl::deno_webidl::init_ops_and_esm(),
|
||||
deno_console::deno_console::init_ops_and_esm(),
|
||||
deno_url::deno_url::init_ops_and_esm(),
|
||||
deno_web::deno_web::init_ops_and_esm::<Permissions>(BlobStore::default(), None),
|
||||
deno_webgpu::deno_webgpu::init_ops_and_esm(true),
|
||||
cts_runner::init_ops_and_esm(),
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
@ -81,16 +81,13 @@ mod native {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn extension() -> deno_core::Extension {
|
||||
deno_core::Extension::builder(env!("CARGO_PKG_NAME"))
|
||||
.ops(vec![
|
||||
op_exit::decl(),
|
||||
op_read_file_sync::decl(),
|
||||
op_write_file_sync::decl(),
|
||||
])
|
||||
.esm(deno_core::include_js_files!("bootstrap.js",))
|
||||
.build()
|
||||
}
|
||||
deno_core::extension!(
|
||||
cts_runner,
|
||||
deps = [deno_webidl, deno_web],
|
||||
ops = [op_exit, op_read_file_sync, op_write_file_sync],
|
||||
esm_entry_point = "ext:cts_runner/bootstrap.js",
|
||||
esm = ["bootstrap.js"],
|
||||
);
|
||||
|
||||
#[op]
|
||||
fn op_exit(code: i32) -> Result<(), AnyError> {
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,7 @@ import {
|
||||
_device,
|
||||
assertDevice,
|
||||
createGPUTexture,
|
||||
GPUTextureUsage,
|
||||
} from "ext:deno_webgpu/01_webgpu.js";
|
||||
|
||||
const _surfaceRid = Symbol("[[surfaceRid]]");
|
||||
@ -130,6 +131,81 @@ function createCanvasContext(options) {
|
||||
return canvasContext;
|
||||
}
|
||||
|
||||
// Converters
|
||||
|
||||
// ENUM: GPUCanvasAlphaMode
|
||||
webidl.converters["GPUCanvasAlphaMode"] = webidl.createEnumConverter(
|
||||
"GPUCanvasAlphaMode",
|
||||
[
|
||||
"opaque",
|
||||
"premultiplied",
|
||||
],
|
||||
);
|
||||
|
||||
// NON-SPEC: ENUM: GPUPresentMode
|
||||
webidl.converters["GPUPresentMode"] = webidl.createEnumConverter(
|
||||
"GPUPresentMode",
|
||||
[
|
||||
"autoVsync",
|
||||
"autoNoVsync",
|
||||
"fifo",
|
||||
"fifoRelaxed",
|
||||
"immediate",
|
||||
"mailbox",
|
||||
],
|
||||
);
|
||||
|
||||
// DICT: GPUCanvasConfiguration
|
||||
const dictMembersGPUCanvasConfiguration = [
|
||||
{ key: "device", converter: webidl.converters.GPUDevice, required: true },
|
||||
{
|
||||
key: "format",
|
||||
converter: webidl.converters.GPUTextureFormat,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: "usage",
|
||||
converter: webidl.converters["GPUTextureUsageFlags"],
|
||||
defaultValue: GPUTextureUsage.RENDER_ATTACHMENT,
|
||||
},
|
||||
{
|
||||
key: "alphaMode",
|
||||
converter: webidl.converters["GPUCanvasAlphaMode"],
|
||||
defaultValue: "opaque",
|
||||
},
|
||||
|
||||
// Extended from spec
|
||||
{
|
||||
key: "presentMode",
|
||||
converter: webidl.converters["GPUPresentMode"],
|
||||
},
|
||||
{
|
||||
key: "width",
|
||||
converter: webidl.converters["long"],
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: "height",
|
||||
converter: webidl.converters["long"],
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: "viewFormats",
|
||||
converter: webidl.createSequenceConverter(
|
||||
webidl.converters["GPUTextureFormat"],
|
||||
),
|
||||
get defaultValue() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
];
|
||||
webidl.converters["GPUCanvasConfiguration"] = webidl
|
||||
.createDictionaryConverter(
|
||||
"GPUCanvasConfiguration",
|
||||
dictMembersGPUCanvasConfiguration,
|
||||
);
|
||||
|
||||
|
||||
window.__bootstrap.webgpu = {
|
||||
...window.__bootstrap.webgpu,
|
||||
GPUCanvasContext,
|
@ -1,82 +0,0 @@
|
||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// @ts-check
|
||||
/// <reference path="../../core/lib.deno_core.d.ts" />
|
||||
/// <reference path="../web/internal.d.ts" />
|
||||
/// <reference path="../web/lib.deno_web.d.ts" />
|
||||
/// <reference path="./lib.deno_webgpu.d.ts" />
|
||||
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import { GPUTextureUsage } from "ext:deno_webgpu/01_webgpu.js";
|
||||
|
||||
// ENUM: GPUCanvasAlphaMode
|
||||
webidl.converters["GPUCanvasAlphaMode"] = webidl.createEnumConverter(
|
||||
"GPUCanvasAlphaMode",
|
||||
[
|
||||
"opaque",
|
||||
"premultiplied",
|
||||
],
|
||||
);
|
||||
|
||||
// NON-SPEC: ENUM: GPUPresentMode
|
||||
webidl.converters["GPUPresentMode"] = webidl.createEnumConverter(
|
||||
"GPUPresentMode",
|
||||
[
|
||||
"autoVsync",
|
||||
"autoNoVsync",
|
||||
"fifo",
|
||||
"fifoRelaxed",
|
||||
"immediate",
|
||||
"mailbox",
|
||||
],
|
||||
);
|
||||
|
||||
// DICT: GPUCanvasConfiguration
|
||||
const dictMembersGPUCanvasConfiguration = [
|
||||
{ key: "device", converter: webidl.converters.GPUDevice, required: true },
|
||||
{
|
||||
key: "format",
|
||||
converter: webidl.converters.GPUTextureFormat,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: "usage",
|
||||
converter: webidl.converters["GPUTextureUsageFlags"],
|
||||
defaultValue: GPUTextureUsage.RENDER_ATTACHMENT,
|
||||
},
|
||||
{
|
||||
key: "alphaMode",
|
||||
converter: webidl.converters["GPUCanvasAlphaMode"],
|
||||
defaultValue: "opaque",
|
||||
},
|
||||
|
||||
// Extended from spec
|
||||
{
|
||||
key: "presentMode",
|
||||
converter: webidl.converters["GPUPresentMode"],
|
||||
},
|
||||
{
|
||||
key: "width",
|
||||
converter: webidl.converters["long"],
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: "height",
|
||||
converter: webidl.converters["long"],
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: "viewFormats",
|
||||
converter: webidl.createSequenceConverter(
|
||||
webidl.converters["GPUTextureFormat"],
|
||||
),
|
||||
get defaultValue() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
];
|
||||
webidl.converters["GPUCanvasConfiguration"] = webidl
|
||||
.createDictionaryConverter(
|
||||
"GPUCanvasConfiguration",
|
||||
dictMembersGPUCanvasConfiguration,
|
||||
);
|
@ -3,10 +3,7 @@
|
||||
#![warn(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::include_js_files;
|
||||
use deno_core::op;
|
||||
use deno_core::Extension;
|
||||
use deno_core::ExtensionBuilder;
|
||||
use deno_core::OpState;
|
||||
use deno_core::Resource;
|
||||
use deno_core::ResourceId;
|
||||
@ -133,29 +130,110 @@ impl Resource for WebGpuQuerySet {
|
||||
}
|
||||
}
|
||||
|
||||
fn ext() -> ExtensionBuilder {
|
||||
Extension::builder_with_deps(env!("CARGO_PKG_NAME"), &["deno_webidl", "deno_web"])
|
||||
}
|
||||
deno_core::extension!(
|
||||
deno_webgpu,
|
||||
deps = [deno_webidl, deno_web],
|
||||
ops = [
|
||||
// Request device/adapter
|
||||
op_webgpu_request_adapter,
|
||||
op_webgpu_request_device,
|
||||
op_webgpu_request_adapter_info,
|
||||
// Query Set
|
||||
op_webgpu_create_query_set,
|
||||
// buffer
|
||||
buffer::op_webgpu_create_buffer,
|
||||
buffer::op_webgpu_buffer_get_mapped_range,
|
||||
buffer::op_webgpu_buffer_unmap,
|
||||
// buffer async
|
||||
buffer::op_webgpu_buffer_get_map_async,
|
||||
// remaining sync ops
|
||||
|
||||
fn ops(ext: &mut ExtensionBuilder, unstable: bool) -> &mut ExtensionBuilder {
|
||||
ext.ops(declare_webgpu_ops()).state(move |state| {
|
||||
// TODO: check & possibly streamline this
|
||||
// Unstable might be able to be OpMiddleware
|
||||
// let unstable_checker = state.borrow::<super::UnstableChecker>();
|
||||
// let unstable = unstable_checker.unstable;
|
||||
state.put(Unstable(unstable));
|
||||
})
|
||||
}
|
||||
|
||||
pub fn init_ops_and_esm(unstable: bool) -> Extension {
|
||||
ops(&mut ext(), unstable)
|
||||
.esm(include_js_files!("01_webgpu.js", "02_idl_types.js",))
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn init_ops(unstable: bool) -> Extension {
|
||||
ops(&mut ext(), unstable).build()
|
||||
}
|
||||
// texture
|
||||
texture::op_webgpu_create_texture,
|
||||
texture::op_webgpu_create_texture_view,
|
||||
// sampler
|
||||
sampler::op_webgpu_create_sampler,
|
||||
// binding
|
||||
binding::op_webgpu_create_bind_group_layout,
|
||||
binding::op_webgpu_create_pipeline_layout,
|
||||
binding::op_webgpu_create_bind_group,
|
||||
// pipeline
|
||||
pipeline::op_webgpu_create_compute_pipeline,
|
||||
pipeline::op_webgpu_compute_pipeline_get_bind_group_layout,
|
||||
pipeline::op_webgpu_create_render_pipeline,
|
||||
pipeline::op_webgpu_render_pipeline_get_bind_group_layout,
|
||||
// command_encoder
|
||||
command_encoder::op_webgpu_create_command_encoder,
|
||||
command_encoder::op_webgpu_command_encoder_begin_render_pass,
|
||||
command_encoder::op_webgpu_command_encoder_begin_compute_pass,
|
||||
command_encoder::op_webgpu_command_encoder_copy_buffer_to_buffer,
|
||||
command_encoder::op_webgpu_command_encoder_copy_buffer_to_texture,
|
||||
command_encoder::op_webgpu_command_encoder_copy_texture_to_buffer,
|
||||
command_encoder::op_webgpu_command_encoder_copy_texture_to_texture,
|
||||
command_encoder::op_webgpu_command_encoder_clear_buffer,
|
||||
command_encoder::op_webgpu_command_encoder_push_debug_group,
|
||||
command_encoder::op_webgpu_command_encoder_pop_debug_group,
|
||||
command_encoder::op_webgpu_command_encoder_insert_debug_marker,
|
||||
command_encoder::op_webgpu_command_encoder_write_timestamp,
|
||||
command_encoder::op_webgpu_command_encoder_resolve_query_set,
|
||||
command_encoder::op_webgpu_command_encoder_finish,
|
||||
render_pass::op_webgpu_render_pass_set_viewport,
|
||||
render_pass::op_webgpu_render_pass_set_scissor_rect,
|
||||
render_pass::op_webgpu_render_pass_set_blend_constant,
|
||||
render_pass::op_webgpu_render_pass_set_stencil_reference,
|
||||
render_pass::op_webgpu_render_pass_begin_pipeline_statistics_query,
|
||||
render_pass::op_webgpu_render_pass_end_pipeline_statistics_query,
|
||||
render_pass::op_webgpu_render_pass_write_timestamp,
|
||||
render_pass::op_webgpu_render_pass_execute_bundles,
|
||||
render_pass::op_webgpu_render_pass_end,
|
||||
render_pass::op_webgpu_render_pass_set_bind_group,
|
||||
render_pass::op_webgpu_render_pass_push_debug_group,
|
||||
render_pass::op_webgpu_render_pass_pop_debug_group,
|
||||
render_pass::op_webgpu_render_pass_insert_debug_marker,
|
||||
render_pass::op_webgpu_render_pass_set_pipeline,
|
||||
render_pass::op_webgpu_render_pass_set_index_buffer,
|
||||
render_pass::op_webgpu_render_pass_set_vertex_buffer,
|
||||
render_pass::op_webgpu_render_pass_draw,
|
||||
render_pass::op_webgpu_render_pass_draw_indexed,
|
||||
render_pass::op_webgpu_render_pass_draw_indirect,
|
||||
render_pass::op_webgpu_render_pass_draw_indexed_indirect,
|
||||
compute_pass::op_webgpu_compute_pass_set_pipeline,
|
||||
compute_pass::op_webgpu_compute_pass_dispatch_workgroups,
|
||||
compute_pass::op_webgpu_compute_pass_dispatch_workgroups_indirect,
|
||||
compute_pass::op_webgpu_compute_pass_begin_pipeline_statistics_query,
|
||||
compute_pass::op_webgpu_compute_pass_end_pipeline_statistics_query,
|
||||
compute_pass::op_webgpu_compute_pass_write_timestamp,
|
||||
compute_pass::op_webgpu_compute_pass_end,
|
||||
compute_pass::op_webgpu_compute_pass_set_bind_group,
|
||||
compute_pass::op_webgpu_compute_pass_push_debug_group,
|
||||
compute_pass::op_webgpu_compute_pass_pop_debug_group,
|
||||
compute_pass::op_webgpu_compute_pass_insert_debug_marker,
|
||||
// bundle
|
||||
bundle::op_webgpu_create_render_bundle_encoder,
|
||||
bundle::op_webgpu_render_bundle_encoder_finish,
|
||||
bundle::op_webgpu_render_bundle_encoder_set_bind_group,
|
||||
bundle::op_webgpu_render_bundle_encoder_push_debug_group,
|
||||
bundle::op_webgpu_render_bundle_encoder_pop_debug_group,
|
||||
bundle::op_webgpu_render_bundle_encoder_insert_debug_marker,
|
||||
bundle::op_webgpu_render_bundle_encoder_set_pipeline,
|
||||
bundle::op_webgpu_render_bundle_encoder_set_index_buffer,
|
||||
bundle::op_webgpu_render_bundle_encoder_set_vertex_buffer,
|
||||
bundle::op_webgpu_render_bundle_encoder_draw,
|
||||
bundle::op_webgpu_render_bundle_encoder_draw_indexed,
|
||||
bundle::op_webgpu_render_bundle_encoder_draw_indirect,
|
||||
// queue
|
||||
queue::op_webgpu_queue_submit,
|
||||
queue::op_webgpu_write_buffer,
|
||||
queue::op_webgpu_write_texture,
|
||||
// shader
|
||||
shader::op_webgpu_create_shader_module,
|
||||
],
|
||||
esm = ["01_webgpu.js"],
|
||||
options = { unstable: bool },
|
||||
state = |state, options| {
|
||||
state.put(Unstable(options.unstable));
|
||||
},
|
||||
);
|
||||
|
||||
fn deserialize_features(features: &wgpu_types::Features) -> Vec<&'static str> {
|
||||
let mut return_features: Vec<&'static str> = vec![];
|
||||
@ -701,103 +779,3 @@ pub fn op_webgpu_create_query_set(
|
||||
()
|
||||
) => state, WebGpuQuerySet)
|
||||
}
|
||||
|
||||
fn declare_webgpu_ops() -> Vec<deno_core::OpDecl> {
|
||||
vec![
|
||||
// Request device/adapter
|
||||
op_webgpu_request_adapter::decl(),
|
||||
op_webgpu_request_device::decl(),
|
||||
op_webgpu_request_adapter_info::decl(),
|
||||
// Query Set
|
||||
op_webgpu_create_query_set::decl(),
|
||||
// buffer
|
||||
buffer::op_webgpu_create_buffer::decl(),
|
||||
buffer::op_webgpu_buffer_get_mapped_range::decl(),
|
||||
buffer::op_webgpu_buffer_unmap::decl(),
|
||||
// buffer async
|
||||
buffer::op_webgpu_buffer_get_map_async::decl(),
|
||||
// remaining sync ops
|
||||
|
||||
// texture
|
||||
texture::op_webgpu_create_texture::decl(),
|
||||
texture::op_webgpu_create_texture_view::decl(),
|
||||
// sampler
|
||||
sampler::op_webgpu_create_sampler::decl(),
|
||||
// binding
|
||||
binding::op_webgpu_create_bind_group_layout::decl(),
|
||||
binding::op_webgpu_create_pipeline_layout::decl(),
|
||||
binding::op_webgpu_create_bind_group::decl(),
|
||||
// pipeline
|
||||
pipeline::op_webgpu_create_compute_pipeline::decl(),
|
||||
pipeline::op_webgpu_compute_pipeline_get_bind_group_layout::decl(),
|
||||
pipeline::op_webgpu_create_render_pipeline::decl(),
|
||||
pipeline::op_webgpu_render_pipeline_get_bind_group_layout::decl(),
|
||||
// command_encoder
|
||||
command_encoder::op_webgpu_create_command_encoder::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_begin_render_pass::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_begin_compute_pass::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_copy_buffer_to_buffer::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_copy_buffer_to_texture::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_copy_texture_to_buffer::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_copy_texture_to_texture::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_clear_buffer::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_push_debug_group::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_pop_debug_group::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_insert_debug_marker::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_write_timestamp::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_resolve_query_set::decl(),
|
||||
command_encoder::op_webgpu_command_encoder_finish::decl(),
|
||||
// render_pass
|
||||
render_pass::op_webgpu_render_pass_set_viewport::decl(),
|
||||
render_pass::op_webgpu_render_pass_set_scissor_rect::decl(),
|
||||
render_pass::op_webgpu_render_pass_set_blend_constant::decl(),
|
||||
render_pass::op_webgpu_render_pass_set_stencil_reference::decl(),
|
||||
render_pass::op_webgpu_render_pass_begin_pipeline_statistics_query::decl(),
|
||||
render_pass::op_webgpu_render_pass_end_pipeline_statistics_query::decl(),
|
||||
render_pass::op_webgpu_render_pass_write_timestamp::decl(),
|
||||
render_pass::op_webgpu_render_pass_execute_bundles::decl(),
|
||||
render_pass::op_webgpu_render_pass_end::decl(),
|
||||
render_pass::op_webgpu_render_pass_set_bind_group::decl(),
|
||||
render_pass::op_webgpu_render_pass_push_debug_group::decl(),
|
||||
render_pass::op_webgpu_render_pass_pop_debug_group::decl(),
|
||||
render_pass::op_webgpu_render_pass_insert_debug_marker::decl(),
|
||||
render_pass::op_webgpu_render_pass_set_pipeline::decl(),
|
||||
render_pass::op_webgpu_render_pass_set_index_buffer::decl(),
|
||||
render_pass::op_webgpu_render_pass_set_vertex_buffer::decl(),
|
||||
render_pass::op_webgpu_render_pass_draw::decl(),
|
||||
render_pass::op_webgpu_render_pass_draw_indexed::decl(),
|
||||
render_pass::op_webgpu_render_pass_draw_indirect::decl(),
|
||||
render_pass::op_webgpu_render_pass_draw_indexed_indirect::decl(),
|
||||
// compute_pass
|
||||
compute_pass::op_webgpu_compute_pass_set_pipeline::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_dispatch_workgroups::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_dispatch_workgroups_indirect::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_begin_pipeline_statistics_query::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_end_pipeline_statistics_query::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_write_timestamp::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_end::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_set_bind_group::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_push_debug_group::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_pop_debug_group::decl(),
|
||||
compute_pass::op_webgpu_compute_pass_insert_debug_marker::decl(),
|
||||
// bundle
|
||||
bundle::op_webgpu_create_render_bundle_encoder::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_finish::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_set_bind_group::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_push_debug_group::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_pop_debug_group::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_insert_debug_marker::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_set_pipeline::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_set_index_buffer::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_set_vertex_buffer::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_draw::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_draw_indexed::decl(),
|
||||
bundle::op_webgpu_render_bundle_encoder_draw_indirect::decl(),
|
||||
// queue
|
||||
queue::op_webgpu_queue_submit::decl(),
|
||||
queue::op_webgpu_write_buffer::decl(),
|
||||
queue::op_webgpu_write_texture::decl(),
|
||||
// shader
|
||||
shader::op_webgpu_create_shader_module::decl(),
|
||||
]
|
||||
}
|
||||
|
@ -2,10 +2,7 @@
|
||||
|
||||
use super::WebGpuResult;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::include_js_files;
|
||||
use deno_core::op;
|
||||
use deno_core::Extension;
|
||||
use deno_core::ExtensionBuilder;
|
||||
use deno_core::OpState;
|
||||
use deno_core::Resource;
|
||||
use deno_core::ResourceId;
|
||||
@ -14,40 +11,20 @@ use std::borrow::Cow;
|
||||
use std::rc::Rc;
|
||||
use wgpu_types::SurfaceStatus;
|
||||
|
||||
fn ext() -> ExtensionBuilder {
|
||||
Extension::builder_with_deps(
|
||||
"deno_webgpu_surface",
|
||||
&["deno_webidl", "deno_web", "deno_webgpu"],
|
||||
)
|
||||
}
|
||||
|
||||
fn ops(ext: &mut ExtensionBuilder, unstable: bool) -> &mut ExtensionBuilder {
|
||||
ext.ops(vec![
|
||||
op_webgpu_surface_configure::decl(),
|
||||
op_webgpu_surface_get_current_texture::decl(),
|
||||
op_webgpu_surface_present::decl(),
|
||||
])
|
||||
.state(move |state| {
|
||||
// TODO: check & possibly streamline this
|
||||
// Unstable might be able to be OpMiddleware
|
||||
// let unstable_checker = state.borrow::<super::UnstableChecker>();
|
||||
// let unstable = unstable_checker.unstable;
|
||||
state.put(super::Unstable(unstable));
|
||||
})
|
||||
}
|
||||
|
||||
pub fn init_ops_and_esm(unstable: bool) -> Extension {
|
||||
ops(&mut ext(), unstable)
|
||||
.esm(include_js_files!(
|
||||
"03_surface.js",
|
||||
"04_surface_idl_types.js",
|
||||
))
|
||||
.build()
|
||||
}
|
||||
|
||||
pub fn init_ops(unstable: bool) -> Extension {
|
||||
ops(&mut ext(), unstable).build()
|
||||
}
|
||||
deno_core::extension!(
|
||||
deno_webgpu_surface,
|
||||
deps = [deno_webidl, deno_web, deno_webgpu],
|
||||
ops = [
|
||||
op_webgpu_surface_configure,
|
||||
op_webgpu_surface_get_current_texture,
|
||||
op_webgpu_surface_present,
|
||||
],
|
||||
esm = ["02_surface.js"],
|
||||
options = { unstable: bool },
|
||||
state = |state, options| {
|
||||
state.put(super::Unstable(options.unstable));
|
||||
},
|
||||
);
|
||||
|
||||
pub struct WebGpuSurface(pub crate::Instance, pub wgpu_core::id::SurfaceId);
|
||||
impl Resource for WebGpuSurface {
|
||||
|
@ -69,7 +69,7 @@ dictionary GPURequestAdapterOptions {
|
||||
|
||||
enum GPUPowerPreference {
|
||||
"low-power",
|
||||
"high-performance"
|
||||
"high-performance",
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
@ -82,7 +82,8 @@ interface GPUAdapter {
|
||||
Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []);
|
||||
};
|
||||
|
||||
dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUDeviceDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
sequence<GPUFeatureName> requiredFeatures = [];
|
||||
record<DOMString, GPUSize64> requiredLimits = {};
|
||||
};
|
||||
@ -90,15 +91,16 @@ dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
||||
enum GPUFeatureName {
|
||||
// api
|
||||
"depth-clip-control",
|
||||
"timestamp-query",
|
||||
"indirect-first-instance",
|
||||
// shader
|
||||
"shader-f16",
|
||||
// texture formats
|
||||
"depth32float-stencil8",
|
||||
"texture-compression-bc",
|
||||
"texture-compression-etc2",
|
||||
"texture-compression-astc",
|
||||
// api
|
||||
"timestamp-query",
|
||||
"indirect-first-instance",
|
||||
// shader
|
||||
"shader-f16",
|
||||
"rg11b10ufloat-renderable",
|
||||
|
||||
// extended from spec
|
||||
@ -169,8 +171,8 @@ GPUDevice includes GPUObjectBase;
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUBuffer {
|
||||
readonly attribute GPUSize64 size;
|
||||
readonly attribute GPUBufferUsageFlags usage;
|
||||
readonly attribute GPUSize64Out size;
|
||||
readonly attribute GPUFlagsConstant usage;
|
||||
|
||||
readonly attribute GPUBufferMapState mapState;
|
||||
|
||||
@ -185,17 +187,18 @@ GPUBuffer includes GPUObjectBase;
|
||||
enum GPUBufferMapState {
|
||||
"unmapped",
|
||||
"pending",
|
||||
"mapped"
|
||||
"mapped",
|
||||
};
|
||||
|
||||
dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUBufferDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
required GPUSize64 size;
|
||||
required GPUBufferUsageFlags usage;
|
||||
boolean mappedAtCreation = false;
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
|
||||
[Exposed=(Window, DedicatedWorker)]
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
namespace GPUBufferUsage {
|
||||
const GPUFlagsConstant MAP_READ = 0x0001;
|
||||
const GPUFlagsConstant MAP_WRITE = 0x0002;
|
||||
@ -210,7 +213,7 @@ namespace GPUBufferUsage {
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUMapModeFlags;
|
||||
[Exposed=(Window, DedicatedWorker)]
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
namespace GPUMapMode {
|
||||
const GPUFlagsConstant READ = 0x0001;
|
||||
const GPUFlagsConstant WRITE = 0x0002;
|
||||
@ -222,18 +225,19 @@ interface GPUTexture {
|
||||
|
||||
undefined destroy();
|
||||
|
||||
readonly attribute GPUIntegerCoordinate width;
|
||||
readonly attribute GPUIntegerCoordinate height;
|
||||
readonly attribute GPUIntegerCoordinate depthOrArrayLayers;
|
||||
readonly attribute GPUIntegerCoordinate mipLevelCount;
|
||||
readonly attribute GPUSize32 sampleCount;
|
||||
readonly attribute GPUIntegerCoordinateOut width;
|
||||
readonly attribute GPUIntegerCoordinateOut height;
|
||||
readonly attribute GPUIntegerCoordinateOut depthOrArrayLayers;
|
||||
readonly attribute GPUIntegerCoordinateOut mipLevelCount;
|
||||
readonly attribute GPUSize32Out sampleCount;
|
||||
readonly attribute GPUTextureDimension dimension;
|
||||
readonly attribute GPUTextureFormat format;
|
||||
readonly attribute GPUTextureUsageFlags usage;
|
||||
readonly attribute GPUFlagsConstant usage;
|
||||
};
|
||||
GPUTexture includes GPUObjectBase;
|
||||
|
||||
dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUTextureDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
required GPUExtent3D size;
|
||||
GPUIntegerCoordinate mipLevelCount = 1;
|
||||
GPUSize32 sampleCount = 1;
|
||||
@ -246,11 +250,11 @@ dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
|
||||
enum GPUTextureDimension {
|
||||
"1d",
|
||||
"2d",
|
||||
"3d"
|
||||
"3d",
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
|
||||
[Exposed=(Window, DedicatedWorker)]
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
namespace GPUTextureUsage {
|
||||
const GPUFlagsConstant COPY_SRC = 0x01;
|
||||
const GPUFlagsConstant COPY_DST = 0x02;
|
||||
@ -264,7 +268,8 @@ interface GPUTextureView {
|
||||
};
|
||||
GPUTextureView includes GPUObjectBase;
|
||||
|
||||
dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUTextureViewDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
GPUTextureFormat format;
|
||||
GPUTextureViewDimension dimension;
|
||||
GPUTextureAspect aspect = "all";
|
||||
@ -280,13 +285,13 @@ enum GPUTextureViewDimension {
|
||||
"2d-array",
|
||||
"cube",
|
||||
"cube-array",
|
||||
"3d"
|
||||
"3d",
|
||||
};
|
||||
|
||||
enum GPUTextureAspect {
|
||||
"all",
|
||||
"stencil-only",
|
||||
"depth-only"
|
||||
"depth-only",
|
||||
};
|
||||
|
||||
enum GPUTextureFormat {
|
||||
@ -406,21 +411,16 @@ enum GPUTextureFormat {
|
||||
"astc-12x10-unorm",
|
||||
"astc-12x10-unorm-srgb",
|
||||
"astc-12x12-unorm",
|
||||
"astc-12x12-unorm-srgb"
|
||||
"astc-12x12-unorm-srgb",
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUExternalTexture {
|
||||
readonly attribute boolean expired;
|
||||
};
|
||||
GPUExternalTexture includes GPUObjectBase;
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUSampler {
|
||||
};
|
||||
GPUSampler includes GPUObjectBase;
|
||||
|
||||
dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUSamplerDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
GPUAddressMode addressModeU = "clamp-to-edge";
|
||||
GPUAddressMode addressModeV = "clamp-to-edge";
|
||||
GPUAddressMode addressModeW = "clamp-to-edge";
|
||||
@ -436,17 +436,17 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
|
||||
enum GPUAddressMode {
|
||||
"clamp-to-edge",
|
||||
"repeat",
|
||||
"mirror-repeat"
|
||||
"mirror-repeat",
|
||||
};
|
||||
|
||||
enum GPUFilterMode {
|
||||
"nearest",
|
||||
"linear"
|
||||
"linear",
|
||||
};
|
||||
|
||||
enum GPUMipmapFilterMode {
|
||||
"nearest",
|
||||
"linear"
|
||||
"linear",
|
||||
};
|
||||
|
||||
enum GPUCompareFunction {
|
||||
@ -457,7 +457,7 @@ enum GPUCompareFunction {
|
||||
"greater",
|
||||
"not-equal",
|
||||
"greater-equal",
|
||||
"always"
|
||||
"always",
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
@ -465,7 +465,8 @@ interface GPUBindGroupLayout {
|
||||
};
|
||||
GPUBindGroupLayout includes GPUObjectBase;
|
||||
|
||||
dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUBindGroupLayoutDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
required sequence<GPUBindGroupLayoutEntry> entries;
|
||||
};
|
||||
|
||||
@ -480,7 +481,7 @@ dictionary GPUBindGroupLayoutEntry {
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUShaderStageFlags;
|
||||
[Exposed=(Window, DedicatedWorker)]
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
namespace GPUShaderStage {
|
||||
const GPUFlagsConstant VERTEX = 0x1;
|
||||
const GPUFlagsConstant FRAGMENT = 0x2;
|
||||
@ -490,7 +491,7 @@ namespace GPUShaderStage {
|
||||
enum GPUBufferBindingType {
|
||||
"uniform",
|
||||
"storage",
|
||||
"read-only-storage"
|
||||
"read-only-storage",
|
||||
};
|
||||
|
||||
dictionary GPUBufferBindingLayout {
|
||||
@ -502,7 +503,7 @@ dictionary GPUBufferBindingLayout {
|
||||
enum GPUSamplerBindingType {
|
||||
"filtering",
|
||||
"non-filtering",
|
||||
"comparison"
|
||||
"comparison",
|
||||
};
|
||||
|
||||
dictionary GPUSamplerBindingLayout {
|
||||
@ -514,7 +515,7 @@ enum GPUTextureSampleType {
|
||||
"unfilterable-float",
|
||||
"depth",
|
||||
"sint",
|
||||
"uint"
|
||||
"uint",
|
||||
};
|
||||
|
||||
dictionary GPUTextureBindingLayout {
|
||||
@ -524,7 +525,7 @@ dictionary GPUTextureBindingLayout {
|
||||
};
|
||||
|
||||
enum GPUStorageTextureAccess {
|
||||
"write-only"
|
||||
"write-only",
|
||||
};
|
||||
|
||||
dictionary GPUStorageTextureBindingLayout {
|
||||
@ -538,7 +539,8 @@ interface GPUBindGroup {
|
||||
};
|
||||
GPUBindGroup includes GPUObjectBase;
|
||||
|
||||
dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUBindGroupDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
required GPUBindGroupLayout layout;
|
||||
required sequence<GPUBindGroupEntry> entries;
|
||||
};
|
||||
@ -567,7 +569,6 @@ dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase {
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUShaderModule {
|
||||
Promise<GPUCompilationInfo> compilationInfo();
|
||||
};
|
||||
GPUShaderModule includes GPUObjectBase;
|
||||
|
||||
@ -578,7 +579,7 @@ dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase {
|
||||
enum GPUCompilationMessageType {
|
||||
"error",
|
||||
"warning",
|
||||
"info"
|
||||
"info",
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), Serializable, SecureContext]
|
||||
@ -597,10 +598,11 @@ interface GPUCompilationInfo {
|
||||
};
|
||||
|
||||
enum GPUAutoLayoutMode {
|
||||
"auto"
|
||||
"auto",
|
||||
};
|
||||
|
||||
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
|
||||
dictionary GPUPipelineDescriptorBase
|
||||
: GPUObjectDescriptorBase {
|
||||
required (GPUPipelineLayout or GPUAutoLayoutMode) layout;
|
||||
};
|
||||
|
||||
@ -622,7 +624,8 @@ interface GPUComputePipeline {
|
||||
GPUComputePipeline includes GPUObjectBase;
|
||||
GPUComputePipeline includes GPUPipelineBase;
|
||||
|
||||
dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
|
||||
dictionary GPUComputePipelineDescriptor
|
||||
: GPUPipelineDescriptorBase {
|
||||
required GPUProgrammableStage compute;
|
||||
};
|
||||
|
||||
@ -632,7 +635,8 @@ interface GPURenderPipeline {
|
||||
GPURenderPipeline includes GPUObjectBase;
|
||||
GPURenderPipeline includes GPUPipelineBase;
|
||||
|
||||
dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
|
||||
dictionary GPURenderPipelineDescriptor
|
||||
: GPUPipelineDescriptorBase {
|
||||
required GPUVertexState vertex;
|
||||
GPUPrimitiveState primitive = {};
|
||||
GPUDepthStencilState depthStencil;
|
||||
@ -655,18 +659,18 @@ enum GPUPrimitiveTopology {
|
||||
"line-list",
|
||||
"line-strip",
|
||||
"triangle-list",
|
||||
"triangle-strip"
|
||||
"triangle-strip",
|
||||
};
|
||||
|
||||
enum GPUFrontFace {
|
||||
"ccw",
|
||||
"cw"
|
||||
"cw",
|
||||
};
|
||||
|
||||
enum GPUCullMode {
|
||||
"none",
|
||||
"front",
|
||||
"back"
|
||||
"back",
|
||||
};
|
||||
|
||||
dictionary GPUMultisampleState {
|
||||
@ -675,7 +679,8 @@ dictionary GPUMultisampleState {
|
||||
boolean alphaToCoverageEnabled = false;
|
||||
};
|
||||
|
||||
dictionary GPUFragmentState : GPUProgrammableStage {
|
||||
dictionary GPUFragmentState
|
||||
: GPUProgrammableStage {
|
||||
required sequence<GPUColorTargetState?> targets;
|
||||
};
|
||||
|
||||
@ -692,7 +697,7 @@ dictionary GPUBlendState {
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
|
||||
[Exposed=(Window, DedicatedWorker)]
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
namespace GPUColorWrite {
|
||||
const GPUFlagsConstant RED = 0x1;
|
||||
const GPUFlagsConstant GREEN = 0x2;
|
||||
@ -720,7 +725,7 @@ enum GPUBlendFactor {
|
||||
"one-minus-dst-alpha",
|
||||
"src-alpha-saturated",
|
||||
"constant",
|
||||
"one-minus-constant"
|
||||
"one-minus-constant",
|
||||
};
|
||||
|
||||
enum GPUBlendOperation {
|
||||
@ -728,14 +733,14 @@ enum GPUBlendOperation {
|
||||
"subtract",
|
||||
"reverse-subtract",
|
||||
"min",
|
||||
"max"
|
||||
"max",
|
||||
};
|
||||
|
||||
dictionary GPUDepthStencilState {
|
||||
required GPUTextureFormat format;
|
||||
|
||||
boolean depthWriteEnabled = false;
|
||||
GPUCompareFunction depthCompare = "always";
|
||||
required boolean depthWriteEnabled;
|
||||
required GPUCompareFunction depthCompare;
|
||||
|
||||
GPUStencilFaceState stencilFront = {};
|
||||
GPUStencilFaceState stencilBack = {};
|
||||
@ -763,12 +768,12 @@ enum GPUStencilOperation {
|
||||
"increment-clamp",
|
||||
"decrement-clamp",
|
||||
"increment-wrap",
|
||||
"decrement-wrap"
|
||||
"decrement-wrap",
|
||||
};
|
||||
|
||||
enum GPUIndexFormat {
|
||||
"uint16",
|
||||
"uint32"
|
||||
"uint32",
|
||||
};
|
||||
|
||||
enum GPUVertexFormat {
|
||||
@ -801,15 +806,16 @@ enum GPUVertexFormat {
|
||||
"sint32",
|
||||
"sint32x2",
|
||||
"sint32x3",
|
||||
"sint32x4"
|
||||
"sint32x4",
|
||||
};
|
||||
|
||||
enum GPUVertexStepMode {
|
||||
"vertex",
|
||||
"instance"
|
||||
"instance",
|
||||
};
|
||||
|
||||
dictionary GPUVertexState : GPUProgrammableStage {
|
||||
dictionary GPUVertexState
|
||||
: GPUProgrammableStage {
|
||||
sequence<GPUVertexBufferLayout?> buffers = [];
|
||||
};
|
||||
|
||||
@ -832,7 +838,8 @@ dictionary GPUImageDataLayout {
|
||||
GPUSize32 rowsPerImage;
|
||||
};
|
||||
|
||||
dictionary GPUImageCopyBuffer : GPUImageDataLayout {
|
||||
dictionary GPUImageCopyBuffer
|
||||
: GPUImageDataLayout {
|
||||
required GPUBuffer buffer;
|
||||
};
|
||||
|
||||
@ -848,7 +855,8 @@ interface GPUCommandBuffer {
|
||||
};
|
||||
GPUCommandBuffer includes GPUObjectBase;
|
||||
|
||||
dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUCommandBufferDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
};
|
||||
|
||||
interface mixin GPUCommandsMixin {
|
||||
@ -901,7 +909,8 @@ GPUCommandEncoder includes GPUObjectBase;
|
||||
GPUCommandEncoder includes GPUCommandsMixin;
|
||||
GPUCommandEncoder includes GPUDebugCommandsMixin;
|
||||
|
||||
dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUCommandEncoderDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
};
|
||||
|
||||
interface mixin GPUBindingCommandsMixin {
|
||||
@ -938,7 +947,8 @@ GPUComputePassEncoder includes GPUCommandsMixin;
|
||||
GPUComputePassEncoder includes GPUDebugCommandsMixin;
|
||||
GPUComputePassEncoder includes GPUBindingCommandsMixin;
|
||||
|
||||
dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUComputePassDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
@ -953,9 +963,6 @@ interface GPURenderPassEncoder {
|
||||
undefined setBlendConstant(GPUColor color);
|
||||
undefined setStencilReference(GPUStencilValue reference);
|
||||
|
||||
undefined beginOcclusionQuery(GPUSize32 queryIndex);
|
||||
undefined endOcclusionQuery();
|
||||
|
||||
undefined beginPipelineStatisticsQuery(GPUQuerySet querySet, GPUSize32 queryIndex);
|
||||
undefined endPipelineStatisticsQuery();
|
||||
|
||||
@ -970,7 +977,8 @@ GPURenderPassEncoder includes GPUDebugCommandsMixin;
|
||||
GPURenderPassEncoder includes GPUBindingCommandsMixin;
|
||||
GPURenderPassEncoder includes GPURenderCommandsMixin;
|
||||
|
||||
dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPURenderPassDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
required sequence<GPURenderPassColorAttachment?> colorAttachments;
|
||||
GPURenderPassDepthStencilAttachment depthStencilAttachment;
|
||||
};
|
||||
@ -987,7 +995,7 @@ dictionary GPURenderPassColorAttachment {
|
||||
dictionary GPURenderPassDepthStencilAttachment {
|
||||
required GPUTextureView view;
|
||||
|
||||
float depthClearValue = 0;
|
||||
float depthClearValue;
|
||||
GPULoadOp depthLoadOp;
|
||||
GPUStoreOp depthStoreOp;
|
||||
boolean depthReadOnly = false;
|
||||
@ -1000,15 +1008,16 @@ dictionary GPURenderPassDepthStencilAttachment {
|
||||
|
||||
enum GPULoadOp {
|
||||
"load",
|
||||
"clear"
|
||||
"clear",
|
||||
};
|
||||
|
||||
enum GPUStoreOp {
|
||||
"store",
|
||||
"discard"
|
||||
"discard",
|
||||
};
|
||||
|
||||
dictionary GPURenderPassLayout : GPUObjectDescriptorBase {
|
||||
dictionary GPURenderPassLayout
|
||||
: GPUObjectDescriptorBase {
|
||||
required sequence<GPUTextureFormat?> colorFormats;
|
||||
GPUTextureFormat depthStencilFormat;
|
||||
GPUSize32 sampleCount = 1;
|
||||
@ -1036,7 +1045,8 @@ interface GPURenderBundle {
|
||||
};
|
||||
GPURenderBundle includes GPUObjectBase;
|
||||
|
||||
dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPURenderBundleDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
@ -1049,7 +1059,8 @@ GPURenderBundleEncoder includes GPUDebugCommandsMixin;
|
||||
GPURenderBundleEncoder includes GPUBindingCommandsMixin;
|
||||
GPURenderBundleEncoder includes GPURenderCommandsMixin;
|
||||
|
||||
dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout {
|
||||
dictionary GPURenderBundleEncoderDescriptor
|
||||
: GPURenderPassLayout {
|
||||
boolean depthReadOnly = false;
|
||||
boolean stencilReadOnly = false;
|
||||
};
|
||||
@ -1080,11 +1091,12 @@ interface GPUQuerySet {
|
||||
undefined destroy();
|
||||
|
||||
readonly attribute GPUQueryType type;
|
||||
readonly attribute GPUSize32 count;
|
||||
readonly attribute GPUSize32Out count;
|
||||
};
|
||||
GPUQuerySet includes GPUObjectBase;
|
||||
|
||||
dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase {
|
||||
dictionary GPUQuerySetDescriptor
|
||||
: GPUObjectDescriptorBase {
|
||||
required GPUQueryType type;
|
||||
required GPUSize32 count;
|
||||
sequence<GPUPipelineStatisticName> pipelineStatistics = [];
|
||||
@ -1093,7 +1105,7 @@ dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase {
|
||||
enum GPUQueryType {
|
||||
"occlusion",
|
||||
"pipeline-statistics",
|
||||
"timestamp"
|
||||
"timestamp",
|
||||
};
|
||||
|
||||
enum GPUPipelineStatisticName {
|
||||
@ -1116,24 +1128,25 @@ interface GPUCanvasContext {
|
||||
|
||||
enum GPUCanvasAlphaMode {
|
||||
"opaque",
|
||||
"premultiplied"
|
||||
"premultiplied",
|
||||
};
|
||||
|
||||
dictionary GPUCanvasConfiguration {
|
||||
required GPUDevice device;
|
||||
required GPUTextureFormat format;
|
||||
GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT
|
||||
GPUCanvasAlphaMode alphaMode = "opaque";
|
||||
sequence<GPUTextureFormat> viewFormats = [];
|
||||
GPUCanvasAlphaMode alphaMode = "opaque";
|
||||
};
|
||||
|
||||
enum GPUDeviceLostReason {
|
||||
"destroyed"
|
||||
"unknown",
|
||||
"destroyed",
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUDeviceLostInfo {
|
||||
readonly attribute (GPUDeviceLostReason or undefined) reason;
|
||||
readonly attribute GPUDeviceLostReason reason;
|
||||
readonly attribute DOMString message;
|
||||
};
|
||||
|
||||
@ -1147,18 +1160,20 @@ interface GPUError {
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUValidationError : GPUError {
|
||||
interface GPUValidationError
|
||||
: GPUError {
|
||||
constructor(DOMString message);
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUOutOfMemoryError : GPUError {
|
||||
interface GPUOutOfMemoryError
|
||||
: GPUError {
|
||||
constructor(DOMString message);
|
||||
};
|
||||
|
||||
enum GPUErrorFilter {
|
||||
"validation",
|
||||
"out-of-memory"
|
||||
"out-of-memory",
|
||||
};
|
||||
|
||||
partial interface GPUDevice {
|
||||
@ -1182,6 +1197,10 @@ typedef [EnforceRange] unsigned long GPUIndex32;
|
||||
typedef [EnforceRange] unsigned long GPUSize32;
|
||||
typedef [EnforceRange] long GPUSignedOffset32;
|
||||
|
||||
typedef unsigned long long GPUSize64Out;
|
||||
typedef unsigned long GPUIntegerCoordinateOut;
|
||||
typedef unsigned long GPUSize32Out;
|
||||
|
||||
typedef unsigned long GPUFlagsConstant;
|
||||
|
||||
dictionary GPUColorDict {
|
||||
|
@ -5,6 +5,6 @@
|
||||
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
|
||||
|
||||
[toolchain]
|
||||
channel = "1.64"
|
||||
channel = "1.65"
|
||||
components = ["rustfmt", "clippy"]
|
||||
targets = ["wasm32-unknown-unknown"]
|
||||
|
Loading…
Reference in New Issue
Block a user