mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
update deno (#2901)
This commit is contained in:
@@ -11,11 +11,11 @@ publish = false
|
||||
resolver = "2"
|
||||
|
||||
[dependencies]
|
||||
deno_console = "0.53.0"
|
||||
deno_core = "0.135.0"
|
||||
deno_url = "0.53.0"
|
||||
deno_web = "0.84.0"
|
||||
deno_webidl = "0.53.0"
|
||||
deno_console = "0.62.0"
|
||||
deno_core = "0.144.0"
|
||||
deno_url = "0.62.0"
|
||||
deno_web = "0.93.0"
|
||||
deno_webidl = "0.62.0"
|
||||
deno_webgpu = { path = "../deno_webgpu" }
|
||||
tokio = { version = "1.17.0", features = ["full"] }
|
||||
tokio = { version = "1.19.0", features = ["full"] }
|
||||
termcolor = "1.1.2"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[package]
|
||||
name = "deno_webgpu"
|
||||
version = "0.54.0"
|
||||
version = "0.63.0"
|
||||
authors = ["the Deno authors"]
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
@@ -11,8 +11,8 @@ repository = "https://github.com/gfx-rs/wgpu"
|
||||
description = "WebGPU implementation for Deno"
|
||||
|
||||
[dependencies]
|
||||
deno_core = "0.135.0"
|
||||
deno_core = "0.144.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tokio = { version = "1.17", features = ["full"] }
|
||||
tokio = { version = "1.19", features = ["full"] }
|
||||
wgpu-core = { path = "../wgpu-core", features = ["trace", "replay", "serde"] }
|
||||
wgpu-types = { path = "../wgpu-types", features = ["trace", "replay", "serde"] }
|
||||
|
||||
@@ -72,6 +72,15 @@
|
||||
const _encoders = Symbol("[[encoders]]");
|
||||
const _encoder = Symbol("[[encoder]]");
|
||||
const _descriptor = Symbol("[[descriptor]]");
|
||||
const _width = Symbol("[[width]]");
|
||||
const _height = Symbol("[[height]]");
|
||||
const _depthOrArrayLayers = Symbol("[[depthOrArrayLayers]]");
|
||||
const _mipLevelCount = Symbol("[[mipLevelCount]]");
|
||||
const _sampleCount = Symbol("[[sampleCount]]");
|
||||
const _dimension = Symbol("[[dimension]]");
|
||||
const _format = Symbol("[[format]]");
|
||||
const _type = Symbol("[[type]]");
|
||||
const _count = Symbol("[[count]]");
|
||||
|
||||
/**
|
||||
* @param {any} self
|
||||
@@ -341,9 +350,9 @@
|
||||
limits: ObjectFreeze(limits),
|
||||
});
|
||||
return createGPUDevice(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
inner,
|
||||
createGPUQueue(descriptor.label ?? null, inner),
|
||||
createGPUQueue(descriptor.label, inner),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -438,10 +447,10 @@
|
||||
}
|
||||
const GPUAdapterInfoPrototype = GPUAdapterInfo.prototype;
|
||||
|
||||
function createGPUSupportedLimits(features) {
|
||||
function createGPUSupportedLimits(limits) {
|
||||
/** @type {GPUSupportedLimits} */
|
||||
const adapterFeatures = webidl.createBranded(GPUSupportedLimits);
|
||||
adapterFeatures[_limits] = features;
|
||||
adapterFeatures[_limits] = limits;
|
||||
return adapterFeatures;
|
||||
}
|
||||
|
||||
@@ -961,7 +970,7 @@
|
||||
};
|
||||
}
|
||||
const buffer = createGPUBuffer(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
descriptor.size,
|
||||
@@ -993,7 +1002,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const texture = createGPUTexture(
|
||||
descriptor.label ?? null,
|
||||
descriptor,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1020,7 +1029,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const sampler = createGPUSampler(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1062,7 +1071,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const bindGroupLayout = createGPUBindGroupLayout(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1105,7 +1114,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const pipelineLayout = createGPUPipelineLayout(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1201,7 +1210,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const bindGroup = createGPUBindGroup(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1226,12 +1235,11 @@
|
||||
device.rid,
|
||||
descriptor.label,
|
||||
descriptor.code,
|
||||
descriptor.sourceMap,
|
||||
);
|
||||
device.pushError(err);
|
||||
|
||||
const shaderModule = createGPUShaderModule(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1286,7 +1294,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const computePipeline = createGPUComputePipeline(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1361,7 +1369,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const renderPipeline = createGPURenderPipeline(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1399,7 +1407,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const commandEncoder = createGPUCommandEncoder(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1434,7 +1442,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const renderBundleEncoder = createGPURenderBundleEncoder(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -1465,7 +1473,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const querySet = createGPUQuerySet(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
descriptor,
|
||||
@@ -1566,7 +1574,7 @@
|
||||
* @param {GPUCommandBuffer[]} commandBuffers
|
||||
*/
|
||||
submit(commandBuffers) {
|
||||
webidl.assertBranded(this, GPUQueue.prototype);
|
||||
webidl.assertBranded(this, GPUQueuePrototype);
|
||||
const prefix = "Failed to execute 'submit' on 'GPUQueue'";
|
||||
webidl.requiredArguments(arguments.length, 1, {
|
||||
prefix,
|
||||
@@ -1601,7 +1609,7 @@
|
||||
}
|
||||
|
||||
onSubmittedWorkDone() {
|
||||
webidl.assertBranded(this, GPUQueue.prototype);
|
||||
webidl.assertBranded(this, GPUQueuePrototype);
|
||||
return PromiseResolve();
|
||||
}
|
||||
|
||||
@@ -1613,7 +1621,7 @@
|
||||
* @param {number} [size]
|
||||
*/
|
||||
writeBuffer(buffer, bufferOffset, data, dataOffset = 0, size) {
|
||||
webidl.assertBranded(this, GPUQueue.prototype);
|
||||
webidl.assertBranded(this, GPUQueuePrototype);
|
||||
const prefix = "Failed to execute 'writeBuffer' on 'GPUQueue'";
|
||||
webidl.requiredArguments(arguments.length, 3, { prefix });
|
||||
buffer = webidl.converters["GPUBuffer"](buffer, {
|
||||
@@ -1667,7 +1675,7 @@
|
||||
* @param {GPUExtent3D} size
|
||||
*/
|
||||
writeTexture(destination, data, dataLayout, size) {
|
||||
webidl.assertBranded(this, GPUQueue.prototype);
|
||||
webidl.assertBranded(this, GPUQueuePrototype);
|
||||
const prefix = "Failed to execute 'writeTexture' on 'GPUQueue'";
|
||||
webidl.requiredArguments(arguments.length, 4, { prefix });
|
||||
destination = webidl.converters.GPUImageCopyTexture(destination, {
|
||||
@@ -1727,6 +1735,7 @@
|
||||
}
|
||||
}
|
||||
GPUObjectBaseMixin("GPUQueue", GPUQueue);
|
||||
const GPUQueuePrototype = GPUQueue.prototype;
|
||||
|
||||
/**
|
||||
* @typedef CreateGPUBufferOptions
|
||||
@@ -1762,25 +1771,18 @@
|
||||
class GPUBuffer {
|
||||
/** @type {InnerGPUDevice} */
|
||||
[_device];
|
||||
|
||||
/** @type {number} */
|
||||
[_rid];
|
||||
|
||||
/** @type {number} */
|
||||
[_size];
|
||||
|
||||
/** @type {number} */
|
||||
[_usage];
|
||||
|
||||
/** @type {"mapped" | "mapped at creation" | "mapped pending" | "unmapped" | "destroy"} */
|
||||
[_state];
|
||||
|
||||
/** @type {[number, number] | null} */
|
||||
[_mappingRange];
|
||||
|
||||
/** @type {[ArrayBuffer, number, number][] | null} */
|
||||
[_mappedRanges];
|
||||
|
||||
/** @type {number} */
|
||||
[_mapMode];
|
||||
|
||||
@@ -1813,7 +1815,7 @@
|
||||
* @param {number} [size]
|
||||
*/
|
||||
async mapAsync(mode, offset = 0, size) {
|
||||
webidl.assertBranded(this, GPUBuffer.prototype);
|
||||
webidl.assertBranded(this, GPUBufferPrototype);
|
||||
const prefix = "Failed to execute 'mapAsync' on 'GPUBuffer'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
mode = webidl.converters.GPUMapModeFlags(mode, {
|
||||
@@ -1913,7 +1915,7 @@
|
||||
* @param {number} size
|
||||
*/
|
||||
getMappedRange(offset = 0, size) {
|
||||
webidl.assertBranded(this, GPUBuffer.prototype);
|
||||
webidl.assertBranded(this, GPUBufferPrototype);
|
||||
const prefix = "Failed to execute 'getMappedRange' on 'GPUBuffer'";
|
||||
offset = webidl.converters.GPUSize64(offset, {
|
||||
prefix,
|
||||
@@ -1968,7 +1970,7 @@
|
||||
}
|
||||
|
||||
unmap() {
|
||||
webidl.assertBranded(this, GPUBuffer.prototype);
|
||||
webidl.assertBranded(this, GPUBufferPrototype);
|
||||
const prefix = "Failed to execute 'unmap' on 'GPUBuffer'";
|
||||
const device = assertDevice(this, { prefix, context: "this" });
|
||||
const bufferRid = assertResource(this, { prefix, context: "this" });
|
||||
@@ -2026,10 +2028,20 @@
|
||||
}
|
||||
|
||||
destroy() {
|
||||
webidl.assertBranded(this, GPUBuffer.prototype);
|
||||
webidl.assertBranded(this, GPUBufferPrototype);
|
||||
this[_cleanup]();
|
||||
}
|
||||
|
||||
get size() {
|
||||
webidl.assertBranded(this, GPUBufferPrototype);
|
||||
return this[_size];
|
||||
}
|
||||
|
||||
get usage() {
|
||||
webidl.assertBranded(this, GPUBufferPrototype);
|
||||
return this[_usage];
|
||||
}
|
||||
|
||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||
return `${this.constructor.name} ${
|
||||
inspect({
|
||||
@@ -2039,6 +2051,7 @@
|
||||
}
|
||||
}
|
||||
GPUObjectBaseMixin("GPUBuffer", GPUBuffer);
|
||||
const GPUBufferPrototype = GPUBuffer.prototype;
|
||||
|
||||
class GPUBufferUsage {
|
||||
constructor() {
|
||||
@@ -2091,18 +2104,26 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | null} label
|
||||
* @param {GPUTextureDescriptor} descriptor
|
||||
* @param {InnerGPUDevice} device
|
||||
* @param {number} rid
|
||||
* @returns {GPUTexture}
|
||||
*/
|
||||
function createGPUTexture(label, device, rid) {
|
||||
function createGPUTexture(descriptor, device, rid) {
|
||||
/** @type {GPUTexture} */
|
||||
const texture = webidl.createBranded(GPUTexture);
|
||||
texture[_label] = label;
|
||||
texture[_label] = descriptor.label;
|
||||
texture[_device] = device;
|
||||
texture[_rid] = rid;
|
||||
texture[_views] = [];
|
||||
texture[_width] = descriptor.size.width;
|
||||
texture[_height] = descriptor.size.height;
|
||||
texture[_depthOrArrayLayers] = descriptor.size.depthOrArrayLayers;
|
||||
texture[_mipLevelCount] = descriptor.mipLevelCount;
|
||||
texture[_sampleCount] = descriptor.sampleCount;
|
||||
texture[_dimension] = descriptor.dimension;
|
||||
texture[_format] = descriptor.format;
|
||||
texture[_usage] = descriptor.usage;
|
||||
return texture;
|
||||
}
|
||||
|
||||
@@ -2114,6 +2135,23 @@
|
||||
/** @type {WeakRef<GPUTextureView>[]} */
|
||||
[_views];
|
||||
|
||||
/** @type {number} */
|
||||
[_width];
|
||||
/** @type {number} */
|
||||
[_height];
|
||||
/** @type {number} */
|
||||
[_depthOrArrayLayers];
|
||||
/** @type {number} */
|
||||
[_mipLevelCount];
|
||||
/** @type {number} */
|
||||
[_sampleCount];
|
||||
/** @type {GPUTextureDimension} */
|
||||
[_dimension];
|
||||
/** @type {GPUTextureFormat} */
|
||||
[_format];
|
||||
/** @type {number} */
|
||||
[_usage];
|
||||
|
||||
[_cleanup]() {
|
||||
const views = this[_views];
|
||||
while (views.length > 0) {
|
||||
@@ -2138,7 +2176,7 @@
|
||||
* @param {GPUTextureViewDescriptor} descriptor
|
||||
*/
|
||||
createView(descriptor = {}) {
|
||||
webidl.assertBranded(this, GPUTexture.prototype);
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
const prefix = "Failed to execute 'createView' on 'GPUTexture'";
|
||||
webidl.requiredArguments(arguments.length, 0, { prefix });
|
||||
descriptor = webidl.converters.GPUTextureViewDescriptor(descriptor, {
|
||||
@@ -2154,7 +2192,7 @@
|
||||
device.pushError(err);
|
||||
|
||||
const textureView = createGPUTextureView(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
this,
|
||||
rid,
|
||||
);
|
||||
@@ -2163,10 +2201,50 @@
|
||||
}
|
||||
|
||||
destroy() {
|
||||
webidl.assertBranded(this, GPUTexture.prototype);
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
this[_cleanup]();
|
||||
}
|
||||
|
||||
get width() {
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
return this[_width];
|
||||
}
|
||||
|
||||
get height() {
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
return this[_height];
|
||||
}
|
||||
|
||||
get depthOrArrayLayers() {
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
return this[_depthOrArrayLayers];
|
||||
}
|
||||
|
||||
get mipLevelCount() {
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
return this[_mipLevelCount];
|
||||
}
|
||||
|
||||
get sampleCount() {
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
return this[_sampleCount];
|
||||
}
|
||||
|
||||
get dimension() {
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
return this[_dimension];
|
||||
}
|
||||
|
||||
get format() {
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
return this[_format];
|
||||
}
|
||||
|
||||
get usage() {
|
||||
webidl.assertBranded(this, GPUTexturePrototype);
|
||||
return this[_usage];
|
||||
}
|
||||
|
||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||
return `${this.constructor.name} ${
|
||||
inspect({
|
||||
@@ -2176,6 +2254,7 @@
|
||||
}
|
||||
}
|
||||
GPUObjectBaseMixin("GPUTexture", GPUTexture);
|
||||
const GPUTexturePrototype = GPUTexture.prototype;
|
||||
|
||||
class GPUTextureUsage {
|
||||
constructor() {
|
||||
@@ -2810,7 +2889,7 @@
|
||||
);
|
||||
|
||||
const renderPassEncoder = createGPURenderPassEncoder(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
this,
|
||||
rid,
|
||||
);
|
||||
@@ -2843,7 +2922,7 @@
|
||||
);
|
||||
|
||||
const computePassEncoder = createGPUComputePassEncoder(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
this,
|
||||
rid,
|
||||
);
|
||||
@@ -3369,7 +3448,7 @@
|
||||
this[_rid] = undefined;
|
||||
|
||||
const commandBuffer = createGPUCommandBuffer(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -4717,7 +4796,7 @@
|
||||
* @param {GPURenderBundleDescriptor} descriptor
|
||||
*/
|
||||
finish(descriptor = {}) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix = "Failed to execute 'finish' on 'GPURenderBundleEncoder'";
|
||||
descriptor = webidl.converters.GPURenderBundleDescriptor(descriptor, {
|
||||
prefix,
|
||||
@@ -4737,7 +4816,7 @@
|
||||
this[_rid] = undefined;
|
||||
|
||||
const renderBundle = createGPURenderBundle(
|
||||
descriptor.label ?? null,
|
||||
descriptor.label,
|
||||
device,
|
||||
rid,
|
||||
);
|
||||
@@ -4753,7 +4832,7 @@
|
||||
dynamicOffsetsDataStart,
|
||||
dynamicOffsetsDataLength,
|
||||
) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'setBindGroup' on 'GPURenderBundleEncoder'";
|
||||
const device = assertDevice(this, { prefix, context: "this" });
|
||||
@@ -4795,7 +4874,7 @@
|
||||
* @param {string} groupLabel
|
||||
*/
|
||||
pushDebugGroup(groupLabel) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'pushDebugGroup' on 'GPURenderBundleEncoder'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
@@ -4816,7 +4895,7 @@
|
||||
}
|
||||
|
||||
popDebugGroup() {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'popDebugGroup' on 'GPURenderBundleEncoder'";
|
||||
assertDevice(this, { prefix, context: "this" });
|
||||
@@ -4834,7 +4913,7 @@
|
||||
* @param {string} markerLabel
|
||||
*/
|
||||
insertDebugMarker(markerLabel) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'insertDebugMarker' on 'GPURenderBundleEncoder'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
@@ -4858,7 +4937,7 @@
|
||||
* @param {GPURenderPipeline} pipeline
|
||||
*/
|
||||
setPipeline(pipeline) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'setPipeline' on 'GPURenderBundleEncoder'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
@@ -4894,7 +4973,7 @@
|
||||
* @param {number} size
|
||||
*/
|
||||
setIndexBuffer(buffer, indexFormat, offset = 0, size = 0) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'setIndexBuffer' on 'GPURenderBundleEncoder'";
|
||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||
@@ -4945,7 +5024,7 @@
|
||||
* @param {number} size
|
||||
*/
|
||||
setVertexBuffer(slot, buffer, offset = 0, size = 0) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'setVertexBuffer' on 'GPURenderBundleEncoder'";
|
||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||
@@ -4996,7 +5075,7 @@
|
||||
* @param {number} firstInstance
|
||||
*/
|
||||
draw(vertexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix = "Failed to execute 'draw' on 'GPURenderBundleEncoder'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
vertexCount = webidl.converters.GPUSize32(vertexCount, {
|
||||
@@ -5044,7 +5123,7 @@
|
||||
baseVertex = 0,
|
||||
firstInstance = 0,
|
||||
) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'drawIndexed' on 'GPURenderBundleEncoder'";
|
||||
webidl.requiredArguments(arguments.length, 1, { prefix });
|
||||
@@ -5089,7 +5168,7 @@
|
||||
* @param {number} indirectOffset
|
||||
*/
|
||||
drawIndirect(indirectBuffer, indirectOffset) {
|
||||
webidl.assertBranded(this, GPURenderBundleEncoder.prototype);
|
||||
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
|
||||
const prefix =
|
||||
"Failed to execute 'drawIndirect' on 'GPURenderBundleEncoder'";
|
||||
webidl.requiredArguments(arguments.length, 2, { prefix });
|
||||
@@ -5136,6 +5215,7 @@
|
||||
}
|
||||
}
|
||||
GPUObjectBaseMixin("GPURenderBundleEncoder", GPURenderBundleEncoder);
|
||||
const GPURenderBundleEncoderPrototype = GPURenderBundleEncoder.prototype;
|
||||
|
||||
/**
|
||||
* @param {string | null} label
|
||||
@@ -5204,6 +5284,10 @@
|
||||
[_rid];
|
||||
/** @type {GPUQuerySetDescriptor} */
|
||||
[_descriptor];
|
||||
/** @type {GPUQueryType} */
|
||||
[_type];
|
||||
/** @type {number} */
|
||||
[_count];
|
||||
|
||||
[_cleanup]() {
|
||||
const rid = this[_rid];
|
||||
@@ -5223,6 +5307,16 @@
|
||||
this[_cleanup]();
|
||||
}
|
||||
|
||||
get type() {
|
||||
webidl.assertBranded(this, GPUQuerySetPrototype);
|
||||
this[_type]();
|
||||
}
|
||||
|
||||
get count() {
|
||||
webidl.assertBranded(this, GPUQuerySetPrototype);
|
||||
this[_count]();
|
||||
}
|
||||
|
||||
[SymbolFor("Deno.privateCustomInspect")](inspect) {
|
||||
return `${this.constructor.name} ${
|
||||
inspect({
|
||||
|
||||
@@ -65,12 +65,6 @@
|
||||
GPUSupportedFeatures.prototype,
|
||||
);
|
||||
|
||||
// ENUM: GPUPredefinedColorSpace
|
||||
webidl.converters.GPUPredefinedColorSpace = webidl.createEnumConverter(
|
||||
"GPUPredefinedColorSpace",
|
||||
["srgb"],
|
||||
);
|
||||
|
||||
// INTERFACE: GPU
|
||||
webidl.converters.GPU = webidl.createInterfaceConverter("GPU", GPU.prototype);
|
||||
|
||||
@@ -112,7 +106,6 @@
|
||||
"GPUFeatureName",
|
||||
[
|
||||
"depth-clip-control",
|
||||
"depth24unorm-stencil8",
|
||||
"depth32float-stencil8",
|
||||
"pipeline-statistics-query",
|
||||
"texture-compression-bc",
|
||||
@@ -342,7 +335,6 @@
|
||||
"depth24plus",
|
||||
"depth24plus-stencil8",
|
||||
"depth32float",
|
||||
"depth24unorm-stencil8",
|
||||
"depth32float-stencil8",
|
||||
"bc1-rgba-unorm",
|
||||
"bc1-rgba-unorm-srgb",
|
||||
@@ -914,7 +906,6 @@
|
||||
converter: webidl.converters["DOMString"],
|
||||
required: true,
|
||||
},
|
||||
{ key: "sourceMap", converter: webidl.converters["object"] },
|
||||
];
|
||||
webidl.converters["GPUShaderModuleDescriptor"] = webidl
|
||||
.createDictionaryConverter(
|
||||
@@ -1845,7 +1836,6 @@
|
||||
key: "depthStencilAttachment",
|
||||
converter: webidl.converters["GPURenderPassDepthStencilAttachment"],
|
||||
},
|
||||
{ key: "occlusionQuerySet", converter: webidl.converters["GPUQuerySet"] },
|
||||
];
|
||||
webidl.converters["GPURenderPassDescriptor"] = webidl
|
||||
.createDictionaryConverter(
|
||||
|
||||
@@ -80,7 +80,6 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
|
||||
label: Option<String>,
|
||||
color_attachments: Vec<Option<GpuRenderPassColorAttachment>>,
|
||||
depth_stencil_attachment: Option<GpuRenderPassDepthStencilAttachment>,
|
||||
_occlusion_query_set: Option<u32>, // not yet implemented
|
||||
) -> Result<WebGpuResult, AnyError> {
|
||||
let command_encoder_resource = state
|
||||
.resource_table
|
||||
|
||||
@@ -128,9 +128,6 @@ fn deserialize_features(features: &wgpu_types::Features) -> Vec<&'static str> {
|
||||
if features.contains(wgpu_types::Features::DEPTH_CLIP_CONTROL) {
|
||||
return_features.push("depth-clip-control");
|
||||
}
|
||||
if features.contains(wgpu_types::Features::DEPTH24UNORM_STENCIL8) {
|
||||
return_features.push("depth24unorm-stencil8");
|
||||
}
|
||||
if features.contains(wgpu_types::Features::DEPTH32FLOAT_STENCIL8) {
|
||||
return_features.push("depth32float-stencil8");
|
||||
}
|
||||
@@ -288,10 +285,6 @@ impl From<GpuRequiredFeatures> for wgpu_types::Features {
|
||||
wgpu_types::Features::DEPTH_CLIP_CONTROL,
|
||||
required_features.0.contains("depth-clip-control"),
|
||||
);
|
||||
features.set(
|
||||
wgpu_types::Features::DEPTH24UNORM_STENCIL8,
|
||||
required_features.0.contains("depth24unorm-stencil8"),
|
||||
);
|
||||
features.set(
|
||||
wgpu_types::Features::DEPTH32FLOAT_STENCIL8,
|
||||
required_features.0.contains("depth32float-stencil8"),
|
||||
|
||||
@@ -22,7 +22,6 @@ pub fn op_webgpu_create_shader_module(
|
||||
device_rid: ResourceId,
|
||||
label: Option<String>,
|
||||
code: String,
|
||||
_source_map: Option<()>, // not yet implemented
|
||||
) -> Result<WebGpuResult, AnyError> {
|
||||
let instance = state.borrow::<super::Instance>();
|
||||
let device_resource = state
|
||||
|
||||
@@ -43,14 +43,10 @@ interface GPUSupportedFeatures {
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUAdapterInfo {
|
||||
readonly attribute DOMString vendor;
|
||||
readonly attribute DOMString architecture;
|
||||
readonly attribute DOMString device;
|
||||
readonly attribute DOMString description;
|
||||
};
|
||||
|
||||
enum GPUPredefinedColorSpace {
|
||||
"srgb",
|
||||
readonly attribute DOMString vendor;
|
||||
readonly attribute DOMString architecture;
|
||||
readonly attribute DOMString device;
|
||||
readonly attribute DOMString description;
|
||||
};
|
||||
|
||||
interface mixin NavigatorGPU {
|
||||
@@ -71,7 +67,7 @@ dictionary GPURequestAdapterOptions {
|
||||
|
||||
enum GPUPowerPreference {
|
||||
"low-power",
|
||||
"high-performance",
|
||||
"high-performance"
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
@@ -91,7 +87,6 @@ dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
|
||||
|
||||
enum GPUFeatureName {
|
||||
"depth-clip-control",
|
||||
"depth24unorm-stencil8",
|
||||
"depth32float-stencil8",
|
||||
"texture-compression-bc",
|
||||
"texture-compression-etc2",
|
||||
@@ -138,6 +133,9 @@ interface GPUBuffer {
|
||||
undefined unmap();
|
||||
|
||||
undefined destroy();
|
||||
|
||||
readonly attribute GPUSize64 size;
|
||||
readonly attribute GPUBufferUsageFlags usage;
|
||||
};
|
||||
GPUBuffer includes GPUObjectBase;
|
||||
|
||||
@@ -174,6 +172,15 @@ interface GPUTexture {
|
||||
GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {});
|
||||
|
||||
undefined destroy();
|
||||
|
||||
readonly attribute GPUIntegerCoordinate width;
|
||||
readonly attribute GPUIntegerCoordinate height;
|
||||
readonly attribute GPUIntegerCoordinate depthOrArrayLayers;
|
||||
readonly attribute GPUIntegerCoordinate mipLevelCount;
|
||||
readonly attribute GPUSize32 sampleCount;
|
||||
readonly attribute GPUTextureDimension dimension;
|
||||
readonly attribute GPUTextureFormat format;
|
||||
readonly attribute GPUTextureUsageFlags usage;
|
||||
};
|
||||
GPUTexture includes GPUObjectBase;
|
||||
|
||||
@@ -189,7 +196,7 @@ dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
|
||||
enum GPUTextureDimension {
|
||||
"1d",
|
||||
"2d",
|
||||
"3d",
|
||||
"3d"
|
||||
};
|
||||
|
||||
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
|
||||
@@ -223,13 +230,13 @@ enum GPUTextureViewDimension {
|
||||
"2d-array",
|
||||
"cube",
|
||||
"cube-array",
|
||||
"3d",
|
||||
"3d"
|
||||
};
|
||||
|
||||
enum GPUTextureAspect {
|
||||
"all",
|
||||
"stencil-only",
|
||||
"depth-only",
|
||||
"depth-only"
|
||||
};
|
||||
|
||||
enum GPUTextureFormat {
|
||||
@@ -287,9 +294,6 @@ enum GPUTextureFormat {
|
||||
"depth24plus-stencil8",
|
||||
"depth32float",
|
||||
|
||||
// "depth24unorm-stencil8" feature
|
||||
"depth24unorm-stencil8",
|
||||
|
||||
// "depth32float-stencil8" feature
|
||||
"depth32float-stencil8",
|
||||
|
||||
@@ -352,7 +356,18 @@ 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;
|
||||
|
||||
dictionary GPUExternalTextureDescriptor : GPUObjectDescriptorBase {
|
||||
required HTMLVideoElement source;
|
||||
PredefinedColorSpace colorSpace = "srgb";
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
@@ -376,17 +391,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 {
|
||||
@@ -397,7 +412,7 @@ enum GPUCompareFunction {
|
||||
"greater",
|
||||
"not-equal",
|
||||
"greater-equal",
|
||||
"always",
|
||||
"always"
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
@@ -430,7 +445,7 @@ namespace GPUShaderStage {
|
||||
enum GPUBufferBindingType {
|
||||
"uniform",
|
||||
"storage",
|
||||
"read-only-storage",
|
||||
"read-only-storage"
|
||||
};
|
||||
|
||||
dictionary GPUBufferBindingLayout {
|
||||
@@ -442,7 +457,7 @@ dictionary GPUBufferBindingLayout {
|
||||
enum GPUSamplerBindingType {
|
||||
"filtering",
|
||||
"non-filtering",
|
||||
"comparison",
|
||||
"comparison"
|
||||
};
|
||||
|
||||
dictionary GPUSamplerBindingLayout {
|
||||
@@ -454,7 +469,7 @@ enum GPUTextureSampleType {
|
||||
"unfilterable-float",
|
||||
"depth",
|
||||
"sint",
|
||||
"uint",
|
||||
"uint"
|
||||
};
|
||||
|
||||
dictionary GPUTextureBindingLayout {
|
||||
@@ -464,7 +479,7 @@ dictionary GPUTextureBindingLayout {
|
||||
};
|
||||
|
||||
enum GPUStorageTextureAccess {
|
||||
"write-only",
|
||||
"write-only"
|
||||
};
|
||||
|
||||
dictionary GPUStorageTextureBindingLayout {
|
||||
@@ -513,13 +528,12 @@ GPUShaderModule includes GPUObjectBase;
|
||||
|
||||
dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase {
|
||||
required USVString code;
|
||||
object sourceMap;
|
||||
};
|
||||
|
||||
enum GPUCompilationMessageType {
|
||||
"error",
|
||||
"warning",
|
||||
"info",
|
||||
"info"
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), Serializable, SecureContext]
|
||||
@@ -555,7 +569,7 @@ dictionary GPUProgrammableStage {
|
||||
record<USVString, GPUPipelineConstantValue> constants;
|
||||
};
|
||||
|
||||
typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32.
|
||||
typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32, and f16 if enabled.
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUComputePipeline {
|
||||
@@ -596,18 +610,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 {
|
||||
@@ -661,7 +675,7 @@ enum GPUBlendFactor {
|
||||
"one-minus-dst-alpha",
|
||||
"src-alpha-saturated",
|
||||
"constant",
|
||||
"one-minus-constant",
|
||||
"one-minus-constant"
|
||||
};
|
||||
|
||||
enum GPUBlendOperation {
|
||||
@@ -669,7 +683,7 @@ enum GPUBlendOperation {
|
||||
"subtract",
|
||||
"reverse-subtract",
|
||||
"min",
|
||||
"max",
|
||||
"max"
|
||||
};
|
||||
|
||||
dictionary GPUDepthStencilState {
|
||||
@@ -704,12 +718,12 @@ enum GPUStencilOperation {
|
||||
"increment-clamp",
|
||||
"decrement-clamp",
|
||||
"increment-wrap",
|
||||
"decrement-wrap",
|
||||
"decrement-wrap"
|
||||
};
|
||||
|
||||
enum GPUIndexFormat {
|
||||
"uint16",
|
||||
"uint32",
|
||||
"uint32"
|
||||
};
|
||||
|
||||
enum GPUVertexFormat {
|
||||
@@ -742,12 +756,12 @@ enum GPUVertexFormat {
|
||||
"sint32",
|
||||
"sint32x2",
|
||||
"sint32x3",
|
||||
"sint32x4",
|
||||
"sint32x4"
|
||||
};
|
||||
|
||||
enum GPUVertexStepMode {
|
||||
"vertex",
|
||||
"instance",
|
||||
"instance"
|
||||
};
|
||||
|
||||
dictionary GPUVertexState : GPUProgrammableStage {
|
||||
@@ -847,12 +861,12 @@ dictionary GPUImageCopyTexture {
|
||||
|
||||
interface mixin GPUBindingCommandsMixin {
|
||||
undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
|
||||
optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
|
||||
optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
|
||||
|
||||
undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
|
||||
Uint32Array dynamicOffsetsData,
|
||||
GPUSize64 dynamicOffsetsDataStart,
|
||||
GPUSize32 dynamicOffsetsDataLength);
|
||||
Uint32Array dynamicOffsetsData,
|
||||
GPUSize64 dynamicOffsetsDataStart,
|
||||
GPUSize32 dynamicOffsetsDataLength);
|
||||
};
|
||||
|
||||
interface mixin GPUDebugCommandsMixin {
|
||||
@@ -885,8 +899,8 @@ dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase {
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPURenderPassEncoder {
|
||||
undefined setViewport(float x, float y,
|
||||
float width, float height,
|
||||
float minDepth, float maxDepth);
|
||||
float width, float height,
|
||||
float minDepth, float maxDepth);
|
||||
|
||||
undefined setScissorRect(GPUIntegerCoordinate x, GPUIntegerCoordinate y,
|
||||
GPUIntegerCoordinate width, GPUIntegerCoordinate height);
|
||||
@@ -914,7 +928,6 @@ GPURenderPassEncoder includes GPURenderCommandsMixin;
|
||||
dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
|
||||
required sequence<GPURenderPassColorAttachment?> colorAttachments;
|
||||
GPURenderPassDepthStencilAttachment depthStencilAttachment;
|
||||
GPUQuerySet occlusionQuerySet;
|
||||
};
|
||||
|
||||
dictionary GPURenderPassColorAttachment {
|
||||
@@ -942,12 +955,12 @@ dictionary GPURenderPassDepthStencilAttachment {
|
||||
|
||||
enum GPULoadOp {
|
||||
"load",
|
||||
"clear",
|
||||
"clear"
|
||||
};
|
||||
|
||||
enum GPUStoreOp {
|
||||
"store",
|
||||
"discard",
|
||||
"discard"
|
||||
};
|
||||
|
||||
dictionary GPURenderPassLayout: GPUObjectDescriptorBase {
|
||||
@@ -1020,6 +1033,9 @@ GPUQueue includes GPUObjectBase;
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
interface GPUQuerySet {
|
||||
undefined destroy();
|
||||
|
||||
readonly attribute GPUQueryType type;
|
||||
readonly attribute GPUSize32 count;
|
||||
};
|
||||
GPUQuerySet includes GPUObjectBase;
|
||||
|
||||
@@ -1032,7 +1048,7 @@ dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase {
|
||||
enum GPUQueryType {
|
||||
"occlusion",
|
||||
"pipeline-statistics",
|
||||
"timestamp",
|
||||
"timestamp"
|
||||
};
|
||||
|
||||
enum GPUPipelineStatisticName {
|
||||
@@ -1044,7 +1060,7 @@ enum GPUPipelineStatisticName {
|
||||
};
|
||||
|
||||
enum GPUDeviceLostReason {
|
||||
"destroyed",
|
||||
"destroyed"
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
@@ -1059,7 +1075,7 @@ partial interface GPUDevice {
|
||||
|
||||
enum GPUErrorFilter {
|
||||
"out-of-memory",
|
||||
"validation",
|
||||
"validation"
|
||||
};
|
||||
|
||||
[Exposed=(Window, DedicatedWorker), SecureContext]
|
||||
|
||||
Reference in New Issue
Block a user