mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
Update deno (#2691)
* update deno crates & align to IDL * revert GPUAutoLayoutMode * revert GPUAutoLayoutMode
This commit is contained in:
parent
435188cb89
commit
dd6febe309
@ -11,11 +11,11 @@ publish = false
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deno_console = "0.43.0"
|
deno_console = "0.53.0"
|
||||||
deno_core = "0.125.0"
|
deno_core = "0.135.0"
|
||||||
deno_url = "0.43.0"
|
deno_url = "0.53.0"
|
||||||
deno_web = "0.74.0"
|
deno_web = "0.84.0"
|
||||||
deno_webidl = "0.43.0"
|
deno_webidl = "0.53.0"
|
||||||
deno_webgpu = { path = "../deno_webgpu" }
|
deno_webgpu = { path = "../deno_webgpu" }
|
||||||
tokio = { version = "1.15.0", features = ["full"] }
|
tokio = { version = "1.17.0", features = ["full"] }
|
||||||
termcolor = "1.1.2"
|
termcolor = "1.1.2"
|
||||||
|
@ -79,7 +79,7 @@ fn extension() -> deno_core::Extension {
|
|||||||
])
|
])
|
||||||
.js(deno_core::include_js_files!(
|
.js(deno_core::include_js_files!(
|
||||||
prefix "deno:cts_runner",
|
prefix "deno:cts_runner",
|
||||||
"src/bootstrap.js",
|
"bootstrap.js",
|
||||||
))
|
))
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "deno_webgpu"
|
name = "deno_webgpu"
|
||||||
version = "0.44.0"
|
version = "0.54.0"
|
||||||
authors = ["the Deno authors"]
|
authors = ["the Deno authors"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@ -11,8 +11,8 @@ repository = "https://github.com/gfx-rs/wgpu"
|
|||||||
description = "WebGPU implementation for Deno"
|
description = "WebGPU implementation for Deno"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deno_core = "0.125.0"
|
deno_core = "0.135.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tokio = { version = "1.10", features = ["full"] }
|
tokio = { version = "1.17", features = ["full"] }
|
||||||
wgpu-core = { path = "../wgpu-core", features = ["trace", "replay", "serde"] }
|
wgpu-core = { path = "../wgpu-core", features = ["trace", "replay", "serde"] }
|
||||||
wgpu-types = { path = "../wgpu-types", features = ["trace", "replay", "serde"] }
|
wgpu-types = { path = "../wgpu-types", features = ["trace", "replay", "serde"] }
|
||||||
|
@ -154,15 +154,35 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GPUOutOfMemoryError extends Error {
|
class GPUError extends Error {
|
||||||
name = "GPUOutOfMemoryError";
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super("device out of memory");
|
super();
|
||||||
|
webidl.illegalConstructor();
|
||||||
|
}
|
||||||
|
|
||||||
|
[_message];
|
||||||
|
get message() {
|
||||||
|
webidl.assertBranded(this, GPUErrorPrototype);
|
||||||
|
return this[_message];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const GPUErrorPrototype = GPUError.prototype;
|
||||||
|
|
||||||
|
class GPUOutOfMemoryError extends GPUError {
|
||||||
|
name = "GPUOutOfMemoryError";
|
||||||
|
constructor(message) {
|
||||||
|
const prefix = "Failed to construct 'GPUOutOfMemoryError'";
|
||||||
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
|
message = webidl.converters.DOMString(message, {
|
||||||
|
prefix,
|
||||||
|
context: "Argument 1",
|
||||||
|
});
|
||||||
|
super(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const GPUOutOfMemoryErrorPrototype = GPUOutOfMemoryError.prototype;
|
const GPUOutOfMemoryErrorPrototype = GPUOutOfMemoryError.prototype;
|
||||||
|
|
||||||
class GPUValidationError extends Error {
|
class GPUValidationError extends GPUError {
|
||||||
name = "GPUValidationError";
|
name = "GPUValidationError";
|
||||||
/** @param {string} message */
|
/** @param {string} message */
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
@ -203,7 +223,7 @@
|
|||||||
if (err) {
|
if (err) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return createGPUAdapter(data.name, data);
|
return createGPUAdapter(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +233,6 @@
|
|||||||
}
|
}
|
||||||
const GPUPrototype = GPU.prototype;
|
const GPUPrototype = GPU.prototype;
|
||||||
|
|
||||||
const _name = Symbol("[[name]]");
|
|
||||||
const _adapter = Symbol("[[adapter]]");
|
const _adapter = Symbol("[[adapter]]");
|
||||||
const _cleanup = Symbol("[[cleanup]]");
|
const _cleanup = Symbol("[[cleanup]]");
|
||||||
|
|
||||||
@ -226,14 +245,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} name
|
|
||||||
* @param {InnerGPUAdapter} inner
|
* @param {InnerGPUAdapter} inner
|
||||||
* @returns {GPUAdapter}
|
* @returns {GPUAdapter}
|
||||||
*/
|
*/
|
||||||
function createGPUAdapter(name, inner) {
|
function createGPUAdapter(inner) {
|
||||||
/** @type {GPUAdapter} */
|
/** @type {GPUAdapter} */
|
||||||
const adapter = webidl.createBranded(GPUAdapter);
|
const adapter = webidl.createBranded(GPUAdapter);
|
||||||
adapter[_name] = name;
|
|
||||||
adapter[_adapter] = {
|
adapter[_adapter] = {
|
||||||
...inner,
|
...inner,
|
||||||
features: createGPUSupportedFeatures(inner.features),
|
features: createGPUSupportedFeatures(inner.features),
|
||||||
@ -243,16 +260,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
class GPUAdapter {
|
class GPUAdapter {
|
||||||
/** @type {string} */
|
|
||||||
[_name];
|
|
||||||
/** @type {InnerGPUAdapter} */
|
/** @type {InnerGPUAdapter} */
|
||||||
[_adapter];
|
[_adapter];
|
||||||
|
|
||||||
/** @returns {string} */
|
|
||||||
get name() {
|
|
||||||
webidl.assertBranded(this, GPUAdapterPrototype);
|
|
||||||
return this[_name];
|
|
||||||
}
|
|
||||||
/** @returns {GPUSupportedFeatures} */
|
/** @returns {GPUSupportedFeatures} */
|
||||||
get features() {
|
get features() {
|
||||||
webidl.assertBranded(this, GPUAdapterPrototype);
|
webidl.assertBranded(this, GPUAdapterPrototype);
|
||||||
@ -315,10 +325,43 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string[]} unmaskHints
|
||||||
|
* @returns {Promise<GPUAdapterInfo>}
|
||||||
|
*/
|
||||||
|
async requestAdapterInfo(unmaskHints = []) {
|
||||||
|
webidl.assertBranded(this, GPUAdapterPrototype);
|
||||||
|
const prefix = "Failed to execute 'requestAdapterInfo' on 'GPUAdapter'";
|
||||||
|
unmaskHints = webidl.converters["sequence<DOMString>"](unmaskHints, {
|
||||||
|
prefix,
|
||||||
|
context: "Argument 1",
|
||||||
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
vendor,
|
||||||
|
architecture,
|
||||||
|
device,
|
||||||
|
description,
|
||||||
|
} = await core.opAsync(
|
||||||
|
"op_webgpu_request_adapter_info",
|
||||||
|
this[_adapter].rid,
|
||||||
|
);
|
||||||
|
|
||||||
|
const adapterInfo = webidl.createBranded(GPUAdapterInfo);
|
||||||
|
adapterInfo[_vendor] = unmaskHints.includes("vendor") ? vendor : "";
|
||||||
|
adapterInfo[_architecture] = unmaskHints.includes("architecture")
|
||||||
|
? architecture
|
||||||
|
: "";
|
||||||
|
adapterInfo[_device] = unmaskHints.includes("device") ? device : "";
|
||||||
|
adapterInfo[_description] = unmaskHints.includes("description")
|
||||||
|
? description
|
||||||
|
: "";
|
||||||
|
return adapterInfo;
|
||||||
|
}
|
||||||
|
|
||||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
return `${this.constructor.name} ${
|
return `${this.constructor.name} ${
|
||||||
inspect({
|
inspect({
|
||||||
name: this.name,
|
|
||||||
features: this.features,
|
features: this.features,
|
||||||
limits: this.limits,
|
limits: this.limits,
|
||||||
})
|
})
|
||||||
@ -327,6 +370,55 @@
|
|||||||
}
|
}
|
||||||
const GPUAdapterPrototype = GPUAdapter.prototype;
|
const GPUAdapterPrototype = GPUAdapter.prototype;
|
||||||
|
|
||||||
|
const _vendor = Symbol("[[vendor]]");
|
||||||
|
const _architecture = Symbol("[[architecture]]");
|
||||||
|
const _description = Symbol("[[description]]");
|
||||||
|
class GPUAdapterInfo {
|
||||||
|
/** @type {string} */
|
||||||
|
[_vendor];
|
||||||
|
/** @returns {string} */
|
||||||
|
get vendor() {
|
||||||
|
webidl.assertBranded(this, GPUAdapterInfoPrototype);
|
||||||
|
return this[_vendor];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @type {string} */
|
||||||
|
[_architecture];
|
||||||
|
/** @returns {string} */
|
||||||
|
get architecture() {
|
||||||
|
webidl.assertBranded(this, GPUAdapterInfoPrototype);
|
||||||
|
return this[_architecture];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @type {string} */
|
||||||
|
[_device];
|
||||||
|
/** @returns {string} */
|
||||||
|
get device() {
|
||||||
|
webidl.assertBranded(this, GPUAdapterInfoPrototype);
|
||||||
|
return this[_device];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @type {string} */
|
||||||
|
[_description];
|
||||||
|
/** @returns {string} */
|
||||||
|
get description() {
|
||||||
|
webidl.assertBranded(this, GPUAdapterInfoPrototype);
|
||||||
|
return this[_description];
|
||||||
|
}
|
||||||
|
|
||||||
|
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||||
|
return `${this.constructor.name} ${
|
||||||
|
inspect({
|
||||||
|
vendor: this.vendor,
|
||||||
|
architecture: this.architecture,
|
||||||
|
device: this.device,
|
||||||
|
description: this.description,
|
||||||
|
})
|
||||||
|
}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const GPUAdapterInfoPrototype = GPUAdapterInfo.prototype;
|
||||||
|
|
||||||
const _limits = Symbol("[[limits]]");
|
const _limits = Symbol("[[limits]]");
|
||||||
|
|
||||||
function createGPUSupportedLimits(features) {
|
function createGPUSupportedLimits(features) {
|
||||||
@ -602,26 +694,24 @@
|
|||||||
* @param {any} type
|
* @param {any} type
|
||||||
*/
|
*/
|
||||||
function GPUObjectBaseMixin(name, type) {
|
function GPUObjectBaseMixin(name, type) {
|
||||||
type.prototype[_label] = undefined;
|
type.prototype[_label] = null;
|
||||||
ObjectDefineProperty(type.prototype, "label", {
|
ObjectDefineProperty(type.prototype, "label", {
|
||||||
/**
|
/**
|
||||||
* @return {string | undefined}
|
* @return {string | null}
|
||||||
*/
|
*/
|
||||||
get() {
|
get() {
|
||||||
webidl.assertBranded(this, type.prototype);
|
webidl.assertBranded(this, type.prototype);
|
||||||
return this[_label];
|
return this[_label];
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @param {string | undefined} label
|
* @param {string | null} label
|
||||||
*/
|
*/
|
||||||
set(label) {
|
set(label) {
|
||||||
webidl.assertBranded(this, type.prototype);
|
webidl.assertBranded(this, type.prototype);
|
||||||
if (label !== undefined) {
|
label = webidl.converters["UVString?"](label, {
|
||||||
label = webidl.converters["UVString"](label, {
|
prefix: `Failed to set 'label' on '${name}'`,
|
||||||
prefix: `Failed to set 'label' on '${name}'`,
|
context: "Argument 1",
|
||||||
context: "Argument 1",
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
this[_label] = label;
|
this[_label] = label;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -4213,9 +4303,14 @@
|
|||||||
* @param {number} workgroupCountY
|
* @param {number} workgroupCountY
|
||||||
* @param {number} workgroupCountZ
|
* @param {number} workgroupCountZ
|
||||||
*/
|
*/
|
||||||
dispatchWorkgroups(workgroupCountX, workgroupCountY = 1, workgroupCountZ = 1) {
|
dispatchWorkgroups(
|
||||||
|
workgroupCountX,
|
||||||
|
workgroupCountY = 1,
|
||||||
|
workgroupCountZ = 1,
|
||||||
|
) {
|
||||||
webidl.assertBranded(this, GPUComputePassEncoderPrototype);
|
webidl.assertBranded(this, GPUComputePassEncoderPrototype);
|
||||||
const prefix = "Failed to execute 'dispatchWorkgroups' on 'GPUComputePassEncoder'";
|
const prefix =
|
||||||
|
"Failed to execute 'dispatchWorkgroups' on 'GPUComputePassEncoder'";
|
||||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||||
workgroupCountX = webidl.converters.GPUSize32(workgroupCountX, {
|
workgroupCountX = webidl.converters.GPUSize32(workgroupCountX, {
|
||||||
prefix,
|
prefix,
|
||||||
@ -5180,6 +5275,7 @@
|
|||||||
GPURenderBundleEncoder,
|
GPURenderBundleEncoder,
|
||||||
GPURenderBundle,
|
GPURenderBundle,
|
||||||
GPUQuerySet,
|
GPUQuerySet,
|
||||||
|
GPUError,
|
||||||
GPUOutOfMemoryError,
|
GPUOutOfMemoryError,
|
||||||
GPUValidationError,
|
GPUValidationError,
|
||||||
};
|
};
|
@ -540,6 +540,15 @@
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// ENUM: GPUMipmapFilterMode
|
||||||
|
webidl.converters["GPUMipmapFilterMode"] = webidl.createEnumConverter(
|
||||||
|
"GPUMipmapFilterMode",
|
||||||
|
[
|
||||||
|
"nearest",
|
||||||
|
"linear",
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
// ENUM: GPUCompareFunction
|
// ENUM: GPUCompareFunction
|
||||||
webidl.converters["GPUCompareFunction"] = webidl.createEnumConverter(
|
webidl.converters["GPUCompareFunction"] = webidl.createEnumConverter(
|
||||||
"GPUCompareFunction",
|
"GPUCompareFunction",
|
||||||
@ -584,7 +593,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "mipmapFilter",
|
key: "mipmapFilter",
|
||||||
converter: webidl.converters["GPUFilterMode"],
|
converter: webidl.converters["GPUMipmapFilterMode"],
|
||||||
defaultValue: "nearest",
|
defaultValue: "nearest",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -938,7 +947,10 @@
|
|||||||
|
|
||||||
// DICTIONARY: GPUPipelineDescriptorBase
|
// DICTIONARY: GPUPipelineDescriptorBase
|
||||||
const dictMembersGPUPipelineDescriptorBase = [
|
const dictMembersGPUPipelineDescriptorBase = [
|
||||||
{ key: "layout", converter: webidl.converters["GPUPipelineLayout"] },
|
{
|
||||||
|
key: "layout",
|
||||||
|
converter: webidl.converters["GPUPipelineLayout"],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
webidl.converters["GPUPipelineDescriptorBase"] = webidl
|
webidl.converters["GPUPipelineDescriptorBase"] = webidl
|
||||||
.createDictionaryConverter(
|
.createDictionaryConverter(
|
@ -215,7 +215,6 @@ pub enum GpuAdapterDeviceOrErr {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct GpuAdapterDevice {
|
pub struct GpuAdapterDevice {
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
name: Option<String>,
|
|
||||||
limits: wgpu_types::Limits,
|
limits: wgpu_types::Limits,
|
||||||
features: Vec<&'static str>,
|
features: Vec<&'static str>,
|
||||||
is_software: bool,
|
is_software: bool,
|
||||||
@ -262,7 +261,6 @@ pub async fn op_webgpu_request_adapter(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let name = gfx_select!(adapter => instance.adapter_get_info(adapter))?.name;
|
|
||||||
let adapter_features = gfx_select!(adapter => instance.adapter_features(adapter))?;
|
let adapter_features = gfx_select!(adapter => instance.adapter_features(adapter))?;
|
||||||
let features = deserialize_features(&adapter_features);
|
let features = deserialize_features(&adapter_features);
|
||||||
let adapter_limits = gfx_select!(adapter => instance.adapter_limits(adapter))?;
|
let adapter_limits = gfx_select!(adapter => instance.adapter_limits(adapter))?;
|
||||||
@ -271,7 +269,6 @@ pub async fn op_webgpu_request_adapter(
|
|||||||
|
|
||||||
Ok(GpuAdapterDeviceOrErr::Features(GpuAdapterDevice {
|
Ok(GpuAdapterDeviceOrErr::Features(GpuAdapterDevice {
|
||||||
rid,
|
rid,
|
||||||
name: Some(name),
|
|
||||||
features,
|
features,
|
||||||
limits: adapter_limits,
|
limits: adapter_limits,
|
||||||
is_software: false,
|
is_software: false,
|
||||||
@ -430,7 +427,6 @@ pub async fn op_webgpu_request_device(
|
|||||||
|
|
||||||
Ok(GpuAdapterDevice {
|
Ok(GpuAdapterDevice {
|
||||||
rid,
|
rid,
|
||||||
name: None,
|
|
||||||
features,
|
features,
|
||||||
limits,
|
limits,
|
||||||
// TODO(lucacasonato): report correctly from wgpu
|
// TODO(lucacasonato): report correctly from wgpu
|
||||||
@ -438,6 +434,35 @@ pub async fn op_webgpu_request_device(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct GPUAdapterInfo {
|
||||||
|
vendor: String,
|
||||||
|
architecture: String,
|
||||||
|
device: String,
|
||||||
|
description: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[op]
|
||||||
|
pub async fn op_webgpu_request_adapter_info(
|
||||||
|
state: Rc<RefCell<OpState>>,
|
||||||
|
adapter_rid: ResourceId,
|
||||||
|
) -> Result<GPUAdapterInfo, AnyError> {
|
||||||
|
let state = state.borrow_mut();
|
||||||
|
let adapter_resource = state.resource_table.get::<WebGpuAdapter>(adapter_rid)?;
|
||||||
|
let adapter = adapter_resource.0;
|
||||||
|
let instance = state.borrow::<Instance>();
|
||||||
|
|
||||||
|
let info = gfx_select!(adapter => instance.adapter_get_info(adapter))?;
|
||||||
|
|
||||||
|
Ok(GPUAdapterInfo {
|
||||||
|
vendor: info.vendor.to_string(),
|
||||||
|
architecture: String::new(), // TODO(#2170)
|
||||||
|
device: info.device.to_string(),
|
||||||
|
description: info.name,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct CreateQuerySetArgs {
|
pub struct CreateQuerySetArgs {
|
||||||
@ -520,6 +545,7 @@ fn declare_webgpu_ops() -> Vec<deno_core::OpDecl> {
|
|||||||
// Request device/adapter
|
// Request device/adapter
|
||||||
op_webgpu_request_adapter::decl(),
|
op_webgpu_request_adapter::decl(),
|
||||||
op_webgpu_request_device::decl(),
|
op_webgpu_request_device::decl(),
|
||||||
|
op_webgpu_request_adapter_info::decl(),
|
||||||
// Query Set
|
// Query Set
|
||||||
op_webgpu_create_query_set::decl(),
|
op_webgpu_create_query_set::decl(),
|
||||||
// buffer
|
// buffer
|
||||||
|
@ -27,7 +27,7 @@ pub struct CreateSamplerArgs {
|
|||||||
address_mode_w: wgpu_types::AddressMode,
|
address_mode_w: wgpu_types::AddressMode,
|
||||||
mag_filter: wgpu_types::FilterMode,
|
mag_filter: wgpu_types::FilterMode,
|
||||||
min_filter: wgpu_types::FilterMode,
|
min_filter: wgpu_types::FilterMode,
|
||||||
mipmap_filter: wgpu_types::FilterMode,
|
mipmap_filter: wgpu_types::FilterMode, // TODO: GPUMipmapFilterMode
|
||||||
lod_min_clamp: f32,
|
lod_min_clamp: f32,
|
||||||
lod_max_clamp: f32,
|
lod_max_clamp: f32,
|
||||||
compare: Option<wgpu_types::CompareFunction>,
|
compare: Option<wgpu_types::CompareFunction>,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
interface mixin GPUObjectBase {
|
interface mixin GPUObjectBase {
|
||||||
attribute (USVString or undefined) label;
|
attribute USVString label;
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPUObjectDescriptorBase {
|
dictionary GPUObjectDescriptorBase {
|
||||||
@ -41,6 +41,14 @@ interface GPUSupportedFeatures {
|
|||||||
readonly setlike<DOMString>;
|
readonly setlike<DOMString>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||||
|
interface GPUAdapterInfo {
|
||||||
|
readonly attribute DOMString vendor;
|
||||||
|
readonly attribute DOMString architecture;
|
||||||
|
readonly attribute DOMString device;
|
||||||
|
readonly attribute DOMString description;
|
||||||
|
};
|
||||||
|
|
||||||
enum GPUPredefinedColorSpace {
|
enum GPUPredefinedColorSpace {
|
||||||
"srgb",
|
"srgb",
|
||||||
};
|
};
|
||||||
@ -68,12 +76,12 @@ enum GPUPowerPreference {
|
|||||||
|
|
||||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||||
interface GPUAdapter {
|
interface GPUAdapter {
|
||||||
readonly attribute DOMString name;
|
|
||||||
[SameObject] readonly attribute GPUSupportedFeatures features;
|
[SameObject] readonly attribute GPUSupportedFeatures features;
|
||||||
[SameObject] readonly attribute GPUSupportedLimits limits;
|
[SameObject] readonly attribute GPUSupportedLimits limits;
|
||||||
readonly attribute boolean isFallbackAdapter;
|
readonly attribute boolean isFallbackAdapter;
|
||||||
|
|
||||||
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
|
||||||
|
Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []);
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
||||||
@ -141,7 +149,7 @@ dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
|
|||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
|
typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
|
||||||
[Exposed=(Window, DedicatedWorker)]
|
[Exposed=(Window, DedicatedWorker)]
|
||||||
interface GPUBufferUsage {
|
namespace GPUBufferUsage {
|
||||||
const GPUFlagsConstant MAP_READ = 0x0001;
|
const GPUFlagsConstant MAP_READ = 0x0001;
|
||||||
const GPUFlagsConstant MAP_WRITE = 0x0002;
|
const GPUFlagsConstant MAP_WRITE = 0x0002;
|
||||||
const GPUFlagsConstant COPY_SRC = 0x0004;
|
const GPUFlagsConstant COPY_SRC = 0x0004;
|
||||||
@ -156,7 +164,7 @@ interface GPUBufferUsage {
|
|||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUMapModeFlags;
|
typedef [EnforceRange] unsigned long GPUMapModeFlags;
|
||||||
[Exposed=(Window, DedicatedWorker)]
|
[Exposed=(Window, DedicatedWorker)]
|
||||||
interface GPUMapMode {
|
namespace GPUMapMode {
|
||||||
const GPUFlagsConstant READ = 0x0001;
|
const GPUFlagsConstant READ = 0x0001;
|
||||||
const GPUFlagsConstant WRITE = 0x0002;
|
const GPUFlagsConstant WRITE = 0x0002;
|
||||||
};
|
};
|
||||||
@ -186,7 +194,7 @@ enum GPUTextureDimension {
|
|||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
|
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
|
||||||
[Exposed=(Window, DedicatedWorker)]
|
[Exposed=(Window, DedicatedWorker)]
|
||||||
interface GPUTextureUsage {
|
namespace GPUTextureUsage {
|
||||||
const GPUFlagsConstant COPY_SRC = 0x01;
|
const GPUFlagsConstant COPY_SRC = 0x01;
|
||||||
const GPUFlagsConstant COPY_DST = 0x02;
|
const GPUFlagsConstant COPY_DST = 0x02;
|
||||||
const GPUFlagsConstant TEXTURE_BINDING = 0x04;
|
const GPUFlagsConstant TEXTURE_BINDING = 0x04;
|
||||||
@ -358,7 +366,7 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
|
|||||||
GPUAddressMode addressModeW = "clamp-to-edge";
|
GPUAddressMode addressModeW = "clamp-to-edge";
|
||||||
GPUFilterMode magFilter = "nearest";
|
GPUFilterMode magFilter = "nearest";
|
||||||
GPUFilterMode minFilter = "nearest";
|
GPUFilterMode minFilter = "nearest";
|
||||||
GPUFilterMode mipmapFilter = "nearest";
|
GPUMipmapFilterMode mipmapFilter = "nearest";
|
||||||
float lodMinClamp = 0;
|
float lodMinClamp = 0;
|
||||||
float lodMaxClamp = 32;
|
float lodMaxClamp = 32;
|
||||||
GPUCompareFunction compare;
|
GPUCompareFunction compare;
|
||||||
@ -376,6 +384,11 @@ enum GPUFilterMode {
|
|||||||
"linear",
|
"linear",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum GPUMipmapFilterMode {
|
||||||
|
"nearest",
|
||||||
|
"linear",
|
||||||
|
};
|
||||||
|
|
||||||
enum GPUCompareFunction {
|
enum GPUCompareFunction {
|
||||||
"never",
|
"never",
|
||||||
"less",
|
"less",
|
||||||
@ -396,14 +409,6 @@ dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
|
|||||||
required sequence<GPUBindGroupLayoutEntry> entries;
|
required sequence<GPUBindGroupLayoutEntry> entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUShaderStageFlags;
|
|
||||||
[Exposed=(Window, DedicatedWorker)]
|
|
||||||
interface GPUShaderStage {
|
|
||||||
const GPUFlagsConstant VERTEX = 0x1;
|
|
||||||
const GPUFlagsConstant FRAGMENT = 0x2;
|
|
||||||
const GPUFlagsConstant COMPUTE = 0x4;
|
|
||||||
};
|
|
||||||
|
|
||||||
dictionary GPUBindGroupLayoutEntry {
|
dictionary GPUBindGroupLayoutEntry {
|
||||||
required GPUIndex32 binding;
|
required GPUIndex32 binding;
|
||||||
required GPUShaderStageFlags visibility;
|
required GPUShaderStageFlags visibility;
|
||||||
@ -414,6 +419,14 @@ dictionary GPUBindGroupLayoutEntry {
|
|||||||
GPUStorageTextureBindingLayout storageTexture;
|
GPUStorageTextureBindingLayout storageTexture;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef [EnforceRange] unsigned long GPUShaderStageFlags;
|
||||||
|
[Exposed=(Window, DedicatedWorker)]
|
||||||
|
namespace GPUShaderStage {
|
||||||
|
const GPUFlagsConstant VERTEX = 0x1;
|
||||||
|
const GPUFlagsConstant FRAGMENT = 0x2;
|
||||||
|
const GPUFlagsConstant COMPUTE = 0x4;
|
||||||
|
};
|
||||||
|
|
||||||
enum GPUBufferBindingType {
|
enum GPUBufferBindingType {
|
||||||
"uniform",
|
"uniform",
|
||||||
"storage",
|
"storage",
|
||||||
@ -525,11 +538,11 @@ interface GPUCompilationInfo {
|
|||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
|
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
|
||||||
GPUPipelineLayout layout;
|
required GPUPipelineLayout layout;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface mixin GPUPipelineBase {
|
interface mixin GPUPipelineBase {
|
||||||
GPUBindGroupLayout getBindGroupLayout(unsigned long index);
|
[NewObject] GPUBindGroupLayout getBindGroupLayout(unsigned long index);
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary GPUProgrammableStage {
|
dictionary GPUProgrammableStage {
|
||||||
@ -564,14 +577,6 @@ dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
|
|||||||
GPUFragmentState fragment;
|
GPUFragmentState fragment;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPUPrimitiveTopology {
|
|
||||||
"point-list",
|
|
||||||
"line-list",
|
|
||||||
"line-strip",
|
|
||||||
"triangle-list",
|
|
||||||
"triangle-strip",
|
|
||||||
};
|
|
||||||
|
|
||||||
dictionary GPUPrimitiveState {
|
dictionary GPUPrimitiveState {
|
||||||
GPUPrimitiveTopology topology = "triangle-list";
|
GPUPrimitiveTopology topology = "triangle-list";
|
||||||
GPUIndexFormat stripIndexFormat;
|
GPUIndexFormat stripIndexFormat;
|
||||||
@ -582,6 +587,14 @@ dictionary GPUPrimitiveState {
|
|||||||
boolean unclippedDepth = false;
|
boolean unclippedDepth = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum GPUPrimitiveTopology {
|
||||||
|
"point-list",
|
||||||
|
"line-list",
|
||||||
|
"line-strip",
|
||||||
|
"triangle-list",
|
||||||
|
"triangle-strip",
|
||||||
|
};
|
||||||
|
|
||||||
enum GPUFrontFace {
|
enum GPUFrontFace {
|
||||||
"ccw",
|
"ccw",
|
||||||
"cw",
|
"cw",
|
||||||
@ -617,7 +630,7 @@ dictionary GPUBlendState {
|
|||||||
|
|
||||||
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
|
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
|
||||||
[Exposed=(Window, DedicatedWorker)]
|
[Exposed=(Window, DedicatedWorker)]
|
||||||
interface GPUColorWrite {
|
namespace GPUColorWrite {
|
||||||
const GPUFlagsConstant RED = 0x1;
|
const GPUFlagsConstant RED = 0x1;
|
||||||
const GPUFlagsConstant GREEN = 0x2;
|
const GPUFlagsConstant GREEN = 0x2;
|
||||||
const GPUFlagsConstant BLUE = 0x4;
|
const GPUFlagsConstant BLUE = 0x4;
|
||||||
@ -828,7 +841,7 @@ dictionary GPUImageCopyTexture {
|
|||||||
GPUTextureAspect aspect = "all";
|
GPUTextureAspect aspect = "all";
|
||||||
};
|
};
|
||||||
|
|
||||||
interface mixin GPUProgrammablePassEncoder {
|
interface mixin GPUBindingCommandsMixin {
|
||||||
undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
|
undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
|
||||||
optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
|
optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
|
||||||
|
|
||||||
@ -860,28 +873,11 @@ interface GPUComputePassEncoder {
|
|||||||
GPUComputePassEncoder includes GPUObjectBase;
|
GPUComputePassEncoder includes GPUObjectBase;
|
||||||
GPUComputePassEncoder includes GPUCommandsMixin;
|
GPUComputePassEncoder includes GPUCommandsMixin;
|
||||||
GPUComputePassEncoder includes GPUDebugCommandsMixin;
|
GPUComputePassEncoder includes GPUDebugCommandsMixin;
|
||||||
GPUComputePassEncoder includes GPUProgrammablePassEncoder;
|
GPUComputePassEncoder includes GPUBindingCommandsMixin;
|
||||||
|
|
||||||
dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase {
|
dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase {
|
||||||
};
|
};
|
||||||
|
|
||||||
interface mixin GPURenderEncoderBase {
|
|
||||||
undefined setPipeline(GPURenderPipeline pipeline);
|
|
||||||
|
|
||||||
undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size);
|
|
||||||
undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size);
|
|
||||||
|
|
||||||
undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1,
|
|
||||||
optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0);
|
|
||||||
undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1,
|
|
||||||
optional GPUSize32 firstIndex = 0,
|
|
||||||
optional GPUSignedOffset32 baseVertex = 0,
|
|
||||||
optional GPUSize32 firstInstance = 0);
|
|
||||||
|
|
||||||
undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
|
||||||
undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
|
||||||
};
|
|
||||||
|
|
||||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||||
interface GPURenderPassEncoder {
|
interface GPURenderPassEncoder {
|
||||||
undefined setViewport(float x, float y,
|
undefined setViewport(float x, float y,
|
||||||
@ -908,8 +904,8 @@ interface GPURenderPassEncoder {
|
|||||||
GPURenderPassEncoder includes GPUObjectBase;
|
GPURenderPassEncoder includes GPUObjectBase;
|
||||||
GPURenderPassEncoder includes GPUCommandsMixin;
|
GPURenderPassEncoder includes GPUCommandsMixin;
|
||||||
GPURenderPassEncoder includes GPUDebugCommandsMixin;
|
GPURenderPassEncoder includes GPUDebugCommandsMixin;
|
||||||
GPURenderPassEncoder includes GPUProgrammablePassEncoder;
|
GPURenderPassEncoder includes GPUBindingCommandsMixin;
|
||||||
GPURenderPassEncoder includes GPURenderEncoderBase;
|
GPURenderPassEncoder includes GPURenderCommandsMixin;
|
||||||
|
|
||||||
dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
|
dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
|
||||||
required sequence<GPURenderPassColorAttachment> colorAttachments;
|
required sequence<GPURenderPassColorAttachment> colorAttachments;
|
||||||
@ -956,6 +952,23 @@ dictionary GPURenderPassLayout: GPUObjectDescriptorBase {
|
|||||||
GPUSize32 sampleCount = 1;
|
GPUSize32 sampleCount = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface mixin GPURenderCommandsMixin {
|
||||||
|
undefined setPipeline(GPURenderPipeline pipeline);
|
||||||
|
|
||||||
|
undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size);
|
||||||
|
undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size);
|
||||||
|
|
||||||
|
undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1,
|
||||||
|
optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0);
|
||||||
|
undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1,
|
||||||
|
optional GPUSize32 firstIndex = 0,
|
||||||
|
optional GPUSignedOffset32 baseVertex = 0,
|
||||||
|
optional GPUSize32 firstInstance = 0);
|
||||||
|
|
||||||
|
undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
||||||
|
undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
|
||||||
|
};
|
||||||
|
|
||||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||||
interface GPURenderBundle {
|
interface GPURenderBundle {
|
||||||
};
|
};
|
||||||
@ -971,8 +984,8 @@ interface GPURenderBundleEncoder {
|
|||||||
GPURenderBundleEncoder includes GPUObjectBase;
|
GPURenderBundleEncoder includes GPUObjectBase;
|
||||||
GPURenderBundleEncoder includes GPUCommandsMixin;
|
GPURenderBundleEncoder includes GPUCommandsMixin;
|
||||||
GPURenderBundleEncoder includes GPUDebugCommandsMixin;
|
GPURenderBundleEncoder includes GPUDebugCommandsMixin;
|
||||||
GPURenderBundleEncoder includes GPUProgrammablePassEncoder;
|
GPURenderBundleEncoder includes GPUBindingCommandsMixin;
|
||||||
GPURenderBundleEncoder includes GPURenderEncoderBase;
|
GPURenderBundleEncoder includes GPURenderCommandsMixin;
|
||||||
|
|
||||||
dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout {
|
dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout {
|
||||||
boolean depthReadOnly = false;
|
boolean depthReadOnly = false;
|
||||||
@ -1046,17 +1059,19 @@ enum GPUErrorFilter {
|
|||||||
};
|
};
|
||||||
|
|
||||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||||
interface GPUOutOfMemoryError {
|
interface GPUError {
|
||||||
constructor();
|
|
||||||
};
|
|
||||||
|
|
||||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
|
||||||
interface GPUValidationError {
|
|
||||||
constructor(DOMString message);
|
|
||||||
readonly attribute DOMString message;
|
readonly attribute DOMString message;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef (GPUOutOfMemoryError or GPUValidationError) GPUError;
|
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||||
|
interface GPUOutOfMemoryError : GPUError {
|
||||||
|
constructor(DOMString message);
|
||||||
|
};
|
||||||
|
|
||||||
|
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||||
|
interface GPUValidationError : GPUError {
|
||||||
|
constructor(DOMString message);
|
||||||
|
};
|
||||||
|
|
||||||
partial interface GPUDevice {
|
partial interface GPUDevice {
|
||||||
undefined pushErrorScope(GPUErrorFilter filter);
|
undefined pushErrorScope(GPUErrorFilter filter);
|
||||||
|
Loading…
Reference in New Issue
Block a user