Skip to content

Commit

Permalink
Update deno (#3041)
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats authored Sep 20, 2022
1 parent ffd7337 commit f8ff5a8
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 56 deletions.
10 changes: 5 additions & 5 deletions cts_runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ publish = false
resolver = "2"

[dependencies]
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_console = "0.69.0"
deno_core = "0.151.0"
deno_url = "0.69.0"
deno_web = "0.100.0"
deno_webidl = "0.69.0"
deno_webgpu = { path = "../deno_webgpu" }
tokio = { version = "1.19.0", features = ["full"] }
termcolor = "1.1.2"
2 changes: 1 addition & 1 deletion deno_webgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = "https://github.com/gfx-rs/wgpu"
description = "WebGPU implementation for Deno"

[dependencies]
deno_core = "0.144.0"
deno_core = "0.151.0"
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.19", features = ["full"] }
wgpu-core = { path = "../wgpu-core", features = ["trace", "replay", "serde", "strict_asserts"] }
Expand Down
60 changes: 37 additions & 23 deletions deno_webgpu/src/01_webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,11 @@
}
const GPUErrorPrototype = GPUError.prototype;

class GPUOutOfMemoryError extends GPUError {
name = "GPUOutOfMemoryError";
class GPUValidationError extends GPUError {
name = "GPUValidationError";
/** @param {string} message */
constructor(message) {
const prefix = "Failed to construct 'GPUOutOfMemoryError'";
const prefix = "Failed to construct 'GPUValidationError'";
webidl.requiredArguments(arguments.length, 1, { prefix });
message = webidl.converters.DOMString(message, {
prefix,
Expand All @@ -213,13 +214,12 @@
super(message);
}
}
const GPUOutOfMemoryErrorPrototype = GPUOutOfMemoryError.prototype;
const GPUValidationErrorPrototype = GPUValidationError.prototype;

class GPUValidationError extends GPUError {
name = "GPUValidationError";
/** @param {string} message */
class GPUOutOfMemoryError extends GPUError {
name = "GPUOutOfMemoryError";
constructor(message) {
const prefix = "Failed to construct 'GPUValidationError'";
const prefix = "Failed to construct 'GPUOutOfMemoryError'";
webidl.requiredArguments(arguments.length, 1, { prefix });
message = webidl.converters.DOMString(message, {
prefix,
Expand All @@ -228,7 +228,7 @@
super(message);
}
}
const GPUValidationErrorPrototype = GPUValidationError.prototype;
const GPUOutOfMemoryErrorPrototype = GPUOutOfMemoryError.prototype;

class GPU {
[webidl.brand] = webidl.brand;
Expand Down Expand Up @@ -510,6 +510,10 @@
webidl.assertBranded(this, GPUSupportedLimitsPrototype);
return this[_limits].maxBindGroups;
}
get maxBufferSize() {
webidl.assertBranded(this, GPUSupportedLimitsPrototype);
return this[_limits].maxBufferSize;
}
get maxDynamicUniformBuffersPerPipelineLayout() {
webidl.assertBranded(this, GPUSupportedLimitsPrototype);
return this[_limits].maxDynamicUniformBuffersPerPipelineLayout;
Expand Down Expand Up @@ -1776,7 +1780,7 @@
[_size];
/** @type {number} */
[_usage];
/** @type {"mapped" | "mapped at creation" | "mapped pending" | "unmapped" | "destroy"} */
/** @type {"mapped" | "mapped at creation" | "pending" | "unmapped" | "destroy"} */
[_state];
/** @type {[number, number] | null} */
[_mappingRange];
Expand Down Expand Up @@ -1808,6 +1812,26 @@
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} offset
Expand Down Expand Up @@ -1886,7 +1910,7 @@
}

this[_mapMode] = mode;
this[_state] = "mapping pending";
this[_state] = "pending";
const promise = PromisePrototypeThen(
core.opAsync(
"op_webgpu_buffer_get_map_async",
Expand Down Expand Up @@ -1979,7 +2003,7 @@
"OperationError",
);
}
if (this[_state] === "mapping pending") {
if (this[_state] === "pending") {
// TODO(lucacasonato): this is not spec compliant.
throw new DOMException(
`${prefix}: can not unmap while mapping. This is a Deno limitation.`,
Expand Down Expand Up @@ -2031,16 +2055,6 @@
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({
Expand Down Expand Up @@ -5358,7 +5372,7 @@
GPURenderBundle,
GPUQuerySet,
GPUError,
GPUOutOfMemoryError,
GPUValidationError,
GPUOutOfMemoryError,
};
})(this);
50 changes: 23 additions & 27 deletions deno_webgpu/webgpu.idl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface GPUSupportedLimits {
readonly attribute unsigned long minUniformBufferOffsetAlignment;
readonly attribute unsigned long minStorageBufferOffsetAlignment;
readonly attribute unsigned long maxVertexBuffers;
readonly attribute unsigned long long maxBufferSize;
readonly attribute unsigned long maxVertexAttributes;
readonly attribute unsigned long maxVertexBufferArrayStride;
readonly attribute unsigned long maxInterStageShaderComponents;
Expand Down Expand Up @@ -128,17 +129,25 @@ GPUDevice includes GPUObjectBase;

[Exposed=(Window, DedicatedWorker), SecureContext]
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);
ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size);
undefined unmap();

undefined destroy();

readonly attribute GPUSize64 size;
readonly attribute GPUBufferUsageFlags usage;
};
GPUBuffer includes GPUObjectBase;

enum GPUBufferMapState {
"unmapped",
"pending",
"mapped"
};

dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
required GPUSize64 size;
required GPUBufferUsageFlags usage;
Expand Down Expand Up @@ -976,11 +985,11 @@ interface mixin GPURenderCommandsMixin {
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);
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);
optional GPUSize32 firstIndex = 0,
optional GPUSignedOffset32 baseVertex = 0,
optional GPUSize32 firstInstance = 0);

undefined drawIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
Expand Down Expand Up @@ -1073,44 +1082,31 @@ partial interface GPUDevice {
readonly attribute Promise<GPUDeviceLostInfo> lost;
};

enum GPUErrorFilter {
"out-of-memory",
"validation"
};

[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUError {
readonly attribute DOMString message;
};

[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUOutOfMemoryError : GPUError {
interface GPUValidationError : GPUError {
constructor(DOMString message);
};

[Exposed=(Window, DedicatedWorker), SecureContext]
interface GPUValidationError : GPUError {
interface GPUOutOfMemoryError : GPUError {
constructor(DOMString message);
};

enum GPUErrorFilter {
"validation",
"out-of-memory"
};

partial interface GPUDevice {
undefined pushErrorScope(GPUErrorFilter filter);
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 {
[Exposed=(Window, DedicatedWorker)]
attribute EventHandler onuncapturederror;
Expand Down

0 comments on commit f8ff5a8

Please sign in to comment.