diff --git a/cts_runner/Cargo.toml b/cts_runner/Cargo.toml index 4a4f5ab494..63df3d1974 100644 --- a/cts_runner/Cargo.toml +++ b/cts_runner/Cargo.toml @@ -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" diff --git a/deno_webgpu/Cargo.toml b/deno_webgpu/Cargo.toml index 2792c722db..e144dcc7da 100644 --- a/deno_webgpu/Cargo.toml +++ b/deno_webgpu/Cargo.toml @@ -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"] } diff --git a/deno_webgpu/src/01_webgpu.js b/deno_webgpu/src/01_webgpu.js index f3091baeac..c01911af52 100644 --- a/deno_webgpu/src/01_webgpu.js +++ b/deno_webgpu/src/01_webgpu.js @@ -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, @@ -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, @@ -228,7 +228,7 @@ super(message); } } - const GPUValidationErrorPrototype = GPUValidationError.prototype; + const GPUOutOfMemoryErrorPrototype = GPUOutOfMemoryError.prototype; class GPU { [webidl.brand] = webidl.brand; @@ -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; @@ -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]; @@ -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 @@ -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", @@ -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.`, @@ -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({ @@ -5358,7 +5372,7 @@ GPURenderBundle, GPUQuerySet, GPUError, - GPUOutOfMemoryError, GPUValidationError, + GPUOutOfMemoryError, }; })(this); diff --git a/deno_webgpu/webgpu.idl b/deno_webgpu/webgpu.idl index 777ffbbfb3..f0fec0b1b9 100644 --- a/deno_webgpu/webgpu.idl +++ b/deno_webgpu/webgpu.idl @@ -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; @@ -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 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; @@ -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); @@ -1073,44 +1082,31 @@ partial interface GPUDevice { readonly attribute Promise 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 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;