Update deno (#3041)

This commit is contained in:
Leo Kettmeir 2022-09-20 17:06:12 +01:00 committed by GitHub
parent ffd733726a
commit f8ff5a8ffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 64 deletions

View File

@ -11,11 +11,11 @@ publish = false
resolver = "2" resolver = "2"
[dependencies] [dependencies]
deno_console = "0.62.0" deno_console = "0.69.0"
deno_core = "0.144.0" deno_core = "0.151.0"
deno_url = "0.62.0" deno_url = "0.69.0"
deno_web = "0.93.0" deno_web = "0.100.0"
deno_webidl = "0.62.0" deno_webidl = "0.69.0"
deno_webgpu = { path = "../deno_webgpu" } deno_webgpu = { path = "../deno_webgpu" }
tokio = { version = "1.19.0", features = ["full"] } tokio = { version = "1.19.0", features = ["full"] }
termcolor = "1.1.2" termcolor = "1.1.2"

View File

@ -11,7 +11,7 @@ repository = "https://github.com/gfx-rs/wgpu"
description = "WebGPU implementation for Deno" description = "WebGPU implementation for Deno"
[dependencies] [dependencies]
deno_core = "0.144.0" deno_core = "0.151.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.19", features = ["full"] } tokio = { version = "1.19", features = ["full"] }
wgpu-core = { path = "../wgpu-core", features = ["trace", "replay", "serde", "strict_asserts"] } wgpu-core = { path = "../wgpu-core", features = ["trace", "replay", "serde", "strict_asserts"] }

View File

@ -201,20 +201,6 @@
} }
const GPUErrorPrototype = GPUError.prototype; 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;
class GPUValidationError extends GPUError { class GPUValidationError extends GPUError {
name = "GPUValidationError"; name = "GPUValidationError";
/** @param {string} message */ /** @param {string} message */
@ -230,6 +216,20 @@
} }
const GPUValidationErrorPrototype = GPUValidationError.prototype; const GPUValidationErrorPrototype = GPUValidationError.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;
class GPU { class GPU {
[webidl.brand] = webidl.brand; [webidl.brand] = webidl.brand;
@ -510,6 +510,10 @@
webidl.assertBranded(this, GPUSupportedLimitsPrototype); webidl.assertBranded(this, GPUSupportedLimitsPrototype);
return this[_limits].maxBindGroups; return this[_limits].maxBindGroups;
} }
get maxBufferSize() {
webidl.assertBranded(this, GPUSupportedLimitsPrototype);
return this[_limits].maxBufferSize;
}
get maxDynamicUniformBuffersPerPipelineLayout() { get maxDynamicUniformBuffersPerPipelineLayout() {
webidl.assertBranded(this, GPUSupportedLimitsPrototype); webidl.assertBranded(this, GPUSupportedLimitsPrototype);
return this[_limits].maxDynamicUniformBuffersPerPipelineLayout; return this[_limits].maxDynamicUniformBuffersPerPipelineLayout;
@ -1776,7 +1780,7 @@
[_size]; [_size];
/** @type {number} */ /** @type {number} */
[_usage]; [_usage];
/** @type {"mapped" | "mapped at creation" | "mapped pending" | "unmapped" | "destroy"} */ /** @type {"mapped" | "mapped at creation" | "pending" | "unmapped" | "destroy"} */
[_state]; [_state];
/** @type {[number, number] | null} */ /** @type {[number, number] | null} */
[_mappingRange]; [_mappingRange];
@ -1808,6 +1812,26 @@
webidl.illegalConstructor(); webidl.illegalConstructor();
} }
get size() {
webidl.assertBranded(this, GPUBufferPrototype);
return this[_size];
}
get usage() {
webidl.assertBranded(this, GPUBufferPrototype);
return this[_usage];
}
get mapState() {
webidl.assertBranded(this, GPUBufferPrototype);
const state = this[_state];
if (state === "mapped at creation") {
return "mapped";
} else {
return state;
}
}
/** /**
* @param {number} mode * @param {number} mode
* @param {number} offset * @param {number} offset
@ -1886,7 +1910,7 @@
} }
this[_mapMode] = mode; this[_mapMode] = mode;
this[_state] = "mapping pending"; this[_state] = "pending";
const promise = PromisePrototypeThen( const promise = PromisePrototypeThen(
core.opAsync( core.opAsync(
"op_webgpu_buffer_get_map_async", "op_webgpu_buffer_get_map_async",
@ -1979,7 +2003,7 @@
"OperationError", "OperationError",
); );
} }
if (this[_state] === "mapping pending") { if (this[_state] === "pending") {
// TODO(lucacasonato): this is not spec compliant. // TODO(lucacasonato): this is not spec compliant.
throw new DOMException( throw new DOMException(
`${prefix}: can not unmap while mapping. This is a Deno limitation.`, `${prefix}: can not unmap while mapping. This is a Deno limitation.`,
@ -2031,16 +2055,6 @@
this[_cleanup](); this[_cleanup]();
} }
get size() {
webidl.assertBranded(this, GPUBufferPrototype);
return this[_size];
}
get usage() {
webidl.assertBranded(this, GPUBufferPrototype);
return this[_usage];
}
[SymbolFor("Deno.privateCustomInspect")](inspect) { [SymbolFor("Deno.privateCustomInspect")](inspect) {
return `${this.constructor.name} ${ return `${this.constructor.name} ${
inspect({ inspect({
@ -5358,7 +5372,7 @@
GPURenderBundle, GPURenderBundle,
GPUQuerySet, GPUQuerySet,
GPUError, GPUError,
GPUOutOfMemoryError,
GPUValidationError, GPUValidationError,
GPUOutOfMemoryError,
}; };
})(this); })(this);

View File

@ -25,6 +25,7 @@ interface GPUSupportedLimits {
readonly attribute unsigned long minUniformBufferOffsetAlignment; readonly attribute unsigned long minUniformBufferOffsetAlignment;
readonly attribute unsigned long minStorageBufferOffsetAlignment; readonly attribute unsigned long minStorageBufferOffsetAlignment;
readonly attribute unsigned long maxVertexBuffers; readonly attribute unsigned long maxVertexBuffers;
readonly attribute unsigned long long maxBufferSize;
readonly attribute unsigned long maxVertexAttributes; readonly attribute unsigned long maxVertexAttributes;
readonly attribute unsigned long maxVertexBufferArrayStride; readonly attribute unsigned long maxVertexBufferArrayStride;
readonly attribute unsigned long maxInterStageShaderComponents; readonly attribute unsigned long maxInterStageShaderComponents;
@ -128,17 +129,25 @@ GPUDevice includes GPUObjectBase;
[Exposed=(Window, DedicatedWorker), SecureContext] [Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUBuffer { interface GPUBuffer {
readonly attribute GPUSize64 size;
readonly attribute GPUBufferUsageFlags usage;
readonly attribute GPUBufferMapState mapState;
Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); Promise<undefined> mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size);
ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size);
undefined unmap(); undefined unmap();
undefined destroy(); undefined destroy();
readonly attribute GPUSize64 size;
readonly attribute GPUBufferUsageFlags usage;
}; };
GPUBuffer includes GPUObjectBase; GPUBuffer includes GPUObjectBase;
enum GPUBufferMapState {
"unmapped",
"pending",
"mapped"
};
dictionary GPUBufferDescriptor : GPUObjectDescriptorBase { dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
required GPUSize64 size; required GPUSize64 size;
required GPUBufferUsageFlags usage; required GPUBufferUsageFlags usage;
@ -976,11 +985,11 @@ interface mixin GPURenderCommandsMixin {
undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, 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, undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1,
optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0); optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0);
undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1, undefined drawIndexed(GPUSize32 indexCount, optional GPUSize32 instanceCount = 1,
optional GPUSize32 firstIndex = 0, optional GPUSize32 firstIndex = 0,
optional GPUSignedOffset32 baseVertex = 0, optional GPUSignedOffset32 baseVertex = 0,
optional GPUSize32 firstInstance = 0); optional GPUSize32 firstInstance = 0);
undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
@ -1073,44 +1082,31 @@ partial interface GPUDevice {
readonly attribute Promise<GPUDeviceLostInfo> lost; readonly attribute Promise<GPUDeviceLostInfo> lost;
}; };
enum GPUErrorFilter {
"out-of-memory",
"validation"
};
[Exposed=(Window, DedicatedWorker), SecureContext] [Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUError { interface GPUError {
readonly attribute DOMString message; readonly attribute DOMString message;
}; };
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUOutOfMemoryError : GPUError {
constructor(DOMString message);
};
[Exposed=(Window, DedicatedWorker), SecureContext] [Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUValidationError : GPUError { interface GPUValidationError : GPUError {
constructor(DOMString message); constructor(DOMString message);
}; };
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUOutOfMemoryError : GPUError {
constructor(DOMString message);
};
enum GPUErrorFilter {
"validation",
"out-of-memory"
};
partial interface GPUDevice { partial interface GPUDevice {
undefined pushErrorScope(GPUErrorFilter filter); undefined pushErrorScope(GPUErrorFilter filter);
Promise<GPUError?> popErrorScope(); Promise<GPUError?> popErrorScope();
}; };
[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUUncapturedErrorEvent : Event {
constructor(
DOMString type,
GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict
);
readonly attribute GPUError error;
};
dictionary GPUUncapturedErrorEventInit : EventInit {
required GPUError error;
};
partial interface GPUDevice { partial interface GPUDevice {
[Exposed=(Window, DedicatedWorker)] [Exposed=(Window, DedicatedWorker)]
attribute EventHandler onuncapturederror; attribute EventHandler onuncapturederror;