diff --git a/deno_webgpu/01_webgpu.js b/deno_webgpu/01_webgpu.js index 2bd9952e70..2e19a5f005 100644 --- a/deno_webgpu/01_webgpu.js +++ b/deno_webgpu/01_webgpu.js @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. // @ts-check /// @@ -25,6 +25,7 @@ MathMax, ObjectDefineProperty, ObjectFreeze, + ObjectPrototypeIsPrototypeOf, Promise, PromiseAll, PromisePrototypeCatch, @@ -42,6 +43,7 @@ SymbolIterator, TypeError, Uint32Array, + Uint32ArrayPrototype, Uint8Array, } = window.__bootstrap.primordials; @@ -157,6 +159,7 @@ super("device out of memory"); } } + const GPUOutOfMemoryErrorPrototype = GPUOutOfMemoryError.prototype; class GPUValidationError extends Error { name = "GPUValidationError"; @@ -171,6 +174,7 @@ super(message); } } + const GPUValidationErrorPrototype = GPUValidationError.prototype; class GPU { [webidl.brand] = webidl.brand; @@ -183,7 +187,7 @@ * @param {GPURequestAdapterOptions} options */ async requestAdapter(options = {}) { - webidl.assertBranded(this, GPU); + webidl.assertBranded(this, GPUPrototype); options = webidl.converters.GPURequestAdapterOptions(options, { prefix: "Failed to execute 'requestAdapter' on 'GPU'", context: "Argument 1", @@ -205,6 +209,7 @@ return `${this.constructor.name} ${inspect({})}`; } } + const GPUPrototype = GPU.prototype; const _name = Symbol("[[name]]"); const _adapter = Symbol("[[adapter]]"); @@ -243,17 +248,17 @@ /** @returns {string} */ get name() { - webidl.assertBranded(this, GPUAdapter); + webidl.assertBranded(this, GPUAdapterPrototype); return this[_name]; } /** @returns {GPUSupportedFeatures} */ get features() { - webidl.assertBranded(this, GPUAdapter); + webidl.assertBranded(this, GPUAdapterPrototype); return this[_adapter].features; } /** @returns {GPUSupportedLimits} */ get limits() { - webidl.assertBranded(this, GPUAdapter); + webidl.assertBranded(this, GPUAdapterPrototype); return this[_adapter].limits; } /** @returns {boolean} */ @@ -270,7 +275,7 @@ * @returns {Promise} */ async requestDevice(descriptor = {}) { - webidl.assertBranded(this, GPUAdapter); + webidl.assertBranded(this, GPUAdapterPrototype); const prefix = "Failed to execute 'requestDevice' on 'GPUAdapter'"; descriptor = webidl.converters.GPUDeviceDescriptor(descriptor, { prefix, @@ -320,6 +325,7 @@ }`; } } + const GPUAdapterPrototype = GPUAdapter.prototype; const _limits = Symbol("[[limits]]"); @@ -368,107 +374,107 @@ } get maxTextureDimension1D() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxTextureDimension1D; } get maxTextureDimension2D() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxTextureDimension2D; } get maxTextureDimension3D() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxTextureDimension3D; } get maxTextureArrayLayers() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxTextureArrayLayers; } get maxBindGroups() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxBindGroups; } get maxDynamicUniformBuffersPerPipelineLayout() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxDynamicUniformBuffersPerPipelineLayout; } get maxDynamicStorageBuffersPerPipelineLayout() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxDynamicStorageBuffersPerPipelineLayout; } get maxSampledTexturesPerShaderStage() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxSampledTexturesPerShaderStage; } get maxSamplersPerShaderStage() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxSamplersPerShaderStage; } get maxStorageBuffersPerShaderStage() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxStorageBuffersPerShaderStage; } get maxStorageTexturesPerShaderStage() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxStorageTexturesPerShaderStage; } get maxUniformBuffersPerShaderStage() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxUniformBuffersPerShaderStage; } get maxUniformBufferBindingSize() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxUniformBufferBindingSize; } get maxStorageBufferBindingSize() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxStorageBufferBindingSize; } get minUniformBufferOffsetAlignment() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].minUniformBufferOffsetAlignment; } get minStorageBufferOffsetAlignment() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].minStorageBufferOffsetAlignment; } get maxVertexBuffers() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxVertexBuffers; } get maxVertexAttributes() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxVertexAttributes; } get maxVertexBufferArrayStride() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxVertexBufferArrayStride; } get maxInterStageShaderComponents() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxInterStageShaderComponents; } get maxComputeWorkgroupStorageSize() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxComputeWorkgroupStorageSize; } get maxComputeInvocationsPerWorkgroup() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxComputeInvocationsPerWorkgroup; } get maxComputeWorkgroupSizeX() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxComputeWorkgroupSizeX; } get maxComputeWorkgroupSizeY() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxComputeWorkgroupSizeY; } get maxComputeWorkgroupSizeZ() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxComputeWorkgroupSizeZ; } get maxComputeWorkgroupsPerDimension() { - webidl.assertBranded(this, GPUSupportedLimits); + webidl.assertBranded(this, GPUSupportedLimitsPrototype); return this[_limits].maxComputeWorkgroupsPerDimension; } @@ -476,6 +482,7 @@ return `${this.constructor.name} ${inspect(this[_limits])}`; } } + const GPUSupportedLimitsPrototype = GPUSupportedLimits.prototype; const _features = Symbol("[[features]]"); @@ -496,42 +503,42 @@ /** @return {IterableIterator<[string, string]>} */ entries() { - webidl.assertBranded(this, GPUSupportedFeatures); + webidl.assertBranded(this, GPUSupportedFeaturesPrototype); return SetPrototypeEntries(this[_features]); } /** @return {void} */ forEach(callbackfn, thisArg) { - webidl.assertBranded(this, GPUSupportedFeatures); + webidl.assertBranded(this, GPUSupportedFeaturesPrototype); SetPrototypeForEach(this[_features], callbackfn, thisArg); } /** @return {boolean} */ has(value) { - webidl.assertBranded(this, GPUSupportedFeatures); + webidl.assertBranded(this, GPUSupportedFeaturesPrototype); return SetPrototypeHas(this[_features], value); } /** @return {IterableIterator} */ keys() { - webidl.assertBranded(this, GPUSupportedFeatures); + webidl.assertBranded(this, GPUSupportedFeaturesPrototype); return SetPrototypeKeys(this[_features]); } /** @return {IterableIterator} */ values() { - webidl.assertBranded(this, GPUSupportedFeatures); + webidl.assertBranded(this, GPUSupportedFeaturesPrototype); return SetPrototypeValues(this[_features]); } /** @return {number} */ get size() { - webidl.assertBranded(this, GPUSupportedFeatures); + webidl.assertBranded(this, GPUSupportedFeaturesPrototype); return this[_features].size; } [SymbolIterator]() { - webidl.assertBranded(this, GPUSupportedFeatures); + webidl.assertBranded(this, GPUSupportedFeaturesPrototype); return this[_features][SymbolIterator](); } @@ -540,6 +547,8 @@ } } + const GPUSupportedFeaturesPrototype = GPUSupportedFeatures.prototype; + const _reason = Symbol("[[reason]]"); const _message = Symbol("[[message]]"); @@ -568,11 +577,11 @@ } get reason() { - webidl.assertBranded(this, GPUDeviceLostInfo); + webidl.assertBranded(this, GPUDeviceLostInfoPrototype); return this[_reason]; } get message() { - webidl.assertBranded(this, GPUDeviceLostInfo); + webidl.assertBranded(this, GPUDeviceLostInfoPrototype); return this[_message]; } @@ -583,6 +592,8 @@ } } + const GPUDeviceLostInfoPrototype = GPUDeviceLostInfo.prototype; + const _label = Symbol("[[label]]"); /** @@ -596,14 +607,14 @@ * @return {string | null} */ get() { - webidl.assertBranded(this, type); + webidl.assertBranded(this, type.prototype); return this[_label]; }, /** * @param {string | null} label */ set(label) { - webidl.assertBranded(this, type); + webidl.assertBranded(this, type.prototype); label = webidl.converters["UVString?"](label, { prefix: `Failed to set 'label' on '${name}'`, context: "Argument 1", @@ -706,7 +717,9 @@ const validationFilteredPromise = PromisePrototypeCatch( operation, (err) => { - if (err instanceof GPUValidationError) return PromiseReject(err); + if (ObjectPrototypeIsPrototypeOf(GPUValidationErrorPrototype, err)) { + return PromiseReject(err); + } return PromiseResolve(); }, ); @@ -729,7 +742,9 @@ ); const oomScope = oomStack[oomStack.length - 1]; const oomFilteredPromise = PromisePrototypeCatch(operation, (err) => { - if (err instanceof GPUOutOfMemoryError) return PromiseReject(err); + if (ObjectPrototypeIsPrototypeOf(GPUOutOfMemoryErrorPrototype, err)) { + return PromiseReject(err); + } return PromiseResolve(); }); if (oomScope) { @@ -785,15 +800,15 @@ } get features() { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); return this[_device].features; } get limits() { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); return this[_device].limits; } get queue() { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); return this[_queue]; } @@ -803,7 +818,7 @@ } destroy() { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); this[_cleanup](); } @@ -812,7 +827,7 @@ * @returns {GPUBuffer} */ createBuffer(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createBuffer' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPUBufferDescriptor(descriptor, { @@ -859,7 +874,7 @@ * @returns {GPUTexture} */ createTexture(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createTexture' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPUTextureDescriptor(descriptor, { @@ -888,7 +903,7 @@ * @returns {GPUSampler} */ createSampler(descriptor = {}) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createSampler' on 'GPUDevice'"; descriptor = webidl.converters.GPUSamplerDescriptor(descriptor, { prefix, @@ -915,7 +930,7 @@ * @returns {GPUBindGroupLayout} */ createBindGroupLayout(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createBindGroupLayout' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPUBindGroupLayoutDescriptor(descriptor, { @@ -958,7 +973,7 @@ * @returns {GPUPipelineLayout} */ createPipelineLayout(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createPipelineLayout' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPUPipelineLayoutDescriptor(descriptor, { @@ -1000,7 +1015,7 @@ * @returns {GPUBindGroup} */ createBindGroup(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createBindGroup' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPUBindGroupDescriptor(descriptor, { @@ -1020,7 +1035,7 @@ const entries = ArrayPrototypeMap(descriptor.entries, (entry, i) => { const context = `entry ${i + 1}`; const resource = entry.resource; - if (resource instanceof GPUSampler) { + if (ObjectPrototypeIsPrototypeOf(GPUSamplerPrototype, resource)) { const rid = assertResource(resource, { prefix, context, @@ -1035,7 +1050,9 @@ kind: "GPUSampler", resource: rid, }; - } else if (resource instanceof GPUTextureView) { + } else if ( + ObjectPrototypeIsPrototypeOf(GPUTextureViewPrototype, resource) + ) { const rid = assertResource(resource, { prefix, context, @@ -1092,7 +1109,7 @@ * @param {GPUShaderModuleDescriptor} descriptor */ createShaderModule(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createShaderModule' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPUShaderModuleDescriptor(descriptor, { @@ -1125,7 +1142,7 @@ * @returns {GPUComputePipeline} */ createComputePipeline(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createComputePipeline' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPUComputePipelineDescriptor(descriptor, { @@ -1182,7 +1199,7 @@ * @returns {GPURenderPipeline} */ createRenderPipeline(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createRenderPipeline' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPURenderPipelineDescriptor(descriptor, { @@ -1267,7 +1284,7 @@ * @returns {GPUCommandEncoder} */ createCommandEncoder(descriptor = {}) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createCommandEncoder' on 'GPUDevice'"; descriptor = webidl.converters.GPUCommandEncoderDescriptor(descriptor, { prefix, @@ -1294,7 +1311,7 @@ * @returns {GPURenderBundleEncoder} */ createRenderBundleEncoder(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createRenderBundleEncoder' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -1329,7 +1346,7 @@ * @returns {GPUQuerySet} */ createQuerySet(descriptor) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createQuerySet' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPUQuerySetDescriptor( @@ -1357,7 +1374,7 @@ } get lost() { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const device = this[_device]; if (!device) { return PromiseResolve(true); @@ -1372,7 +1389,7 @@ * @param {GPUErrorFilter} filter */ pushErrorScope(filter) { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'pushErrorScope' on 'GPUDevice'"; webidl.requiredArguments(arguments.length, 1, { prefix }); filter = webidl.converters.GPUErrorFilter(filter, { @@ -1388,7 +1405,7 @@ */ // deno-lint-ignore require-await async popErrorScope() { - webidl.assertBranded(this, GPUDevice); + webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'popErrorScope' on 'GPUDevice'"; const device = assertDevice(this, { prefix, context: "this" }); if (device.isLost) { @@ -1421,6 +1438,7 @@ } } GPUObjectBaseMixin("GPUDevice", GPUDevice); + const GPUDevicePrototype = GPUDevice.prototype; /** * @param {string | null} label @@ -1447,7 +1465,7 @@ * @param {GPUCommandBuffer[]} commandBuffers */ submit(commandBuffers) { - webidl.assertBranded(this, GPUQueue); + webidl.assertBranded(this, GPUQueue.prototype); const prefix = "Failed to execute 'submit' on 'GPUQueue'"; webidl.requiredArguments(arguments.length, 1, { prefix, @@ -1481,7 +1499,7 @@ } onSubmittedWorkDone() { - webidl.assertBranded(this, GPUQueue); + webidl.assertBranded(this, GPUQueue.prototype); return PromiseResolve(); } @@ -1493,7 +1511,7 @@ * @param {number} [size] */ writeBuffer(buffer, bufferOffset, data, dataOffset = 0, size) { - webidl.assertBranded(this, GPUQueue); + webidl.assertBranded(this, GPUQueue.prototype); const prefix = "Failed to execute 'writeBuffer' on 'GPUQueue'"; webidl.requiredArguments(arguments.length, 3, { prefix }); buffer = webidl.converters["GPUBuffer"](buffer, { @@ -1549,7 +1567,7 @@ * @param {GPUExtent3D} size */ writeTexture(destination, data, dataLayout, size) { - webidl.assertBranded(this, GPUQueue); + webidl.assertBranded(this, GPUQueue.prototype); const prefix = "Failed to execute 'writeTexture' on 'GPUQueue'"; webidl.requiredArguments(arguments.length, 4, { prefix }); destination = webidl.converters.GPUImageCopyTexture(destination, { @@ -1706,7 +1724,7 @@ * @param {number} [size] */ async mapAsync(mode, offset = 0, size) { - webidl.assertBranded(this, GPUBuffer); + webidl.assertBranded(this, GPUBuffer.prototype); const prefix = "Failed to execute 'mapAsync' on 'GPUBuffer'"; webidl.requiredArguments(arguments.length, 1, { prefix }); mode = webidl.converters.GPUMapModeFlags(mode, { @@ -1808,7 +1826,7 @@ * @param {number} size */ getMappedRange(offset = 0, size) { - webidl.assertBranded(this, GPUBuffer); + webidl.assertBranded(this, GPUBuffer.prototype); const prefix = "Failed to execute 'getMappedRange' on 'GPUBuffer'"; offset = webidl.converters.GPUSize64(offset, { prefix, @@ -1865,7 +1883,7 @@ } unmap() { - webidl.assertBranded(this, GPUBuffer); + webidl.assertBranded(this, GPUBuffer.prototype); const prefix = "Failed to execute 'unmap' on 'GPUBuffer'"; const device = assertDevice(this, { prefix, context: "this" }); const bufferRid = assertResource(this, { prefix, context: "this" }); @@ -1921,7 +1939,7 @@ } destroy() { - webidl.assertBranded(this, GPUBuffer); + webidl.assertBranded(this, GPUBuffer.prototype); this[_cleanup](); } @@ -2035,7 +2053,7 @@ * @param {GPUTextureViewDescriptor} descriptor */ createView(descriptor = {}) { - webidl.assertBranded(this, GPUTexture); + webidl.assertBranded(this, GPUTexture.prototype); const prefix = "Failed to execute 'createView' on 'GPUTexture'"; webidl.requiredArguments(arguments.length, 0, { prefix }); descriptor = webidl.converters.GPUTextureViewDescriptor(descriptor, { @@ -2060,7 +2078,7 @@ } destroy() { - webidl.assertBranded(this, GPUTexture); + webidl.assertBranded(this, GPUTexture.prototype); this[_cleanup](); } @@ -2140,7 +2158,7 @@ } } GPUObjectBaseMixin("GPUTextureView", GPUTextureView); - + const GPUTextureViewPrototype = GPUTextureView.prototype; /** * @param {string | null} label * @param {InnerGPUDevice} device @@ -2183,7 +2201,7 @@ } } GPUObjectBaseMixin("GPUSampler", GPUSampler); - + const GPUSamplerPrototype = GPUSampler.prototype; /** * @param {string | null} label * @param {InnerGPUDevice} device @@ -2416,7 +2434,7 @@ * @returns {GPUBindGroupLayout} */ getBindGroupLayout(index) { - webidl.assertBranded(this, GPUComputePipeline); + webidl.assertBranded(this, GPUComputePipelinePrototype); const prefix = "Failed to execute 'getBindGroupLayout' on 'GPUComputePipeline'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -2453,6 +2471,7 @@ } } GPUObjectBaseMixin("GPUComputePipeline", GPUComputePipeline); + const GPUComputePipelinePrototype = GPUComputePipeline.prototype; /** * @param {string | null} label @@ -2491,7 +2510,7 @@ * @param {number} index */ getBindGroupLayout(index) { - webidl.assertBranded(this, GPURenderPipeline); + webidl.assertBranded(this, GPURenderPipelinePrototype); const prefix = "Failed to execute 'getBindGroupLayout' on 'GPURenderPipeline'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -2528,6 +2547,7 @@ } } GPUObjectBaseMixin("GPURenderPipeline", GPURenderPipeline); + const GPURenderPipelinePrototype = GPURenderPipeline.prototype; class GPUColorWrite { constructor() { @@ -2601,7 +2621,7 @@ * @return {GPURenderPassEncoder} */ beginRenderPass(descriptor) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'beginRenderPass' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -2751,7 +2771,7 @@ * @param {GPUComputePassDescriptor} descriptor */ beginComputePass(descriptor = {}) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'beginComputePass' on 'GPUCommandEncoder'"; descriptor = webidl.converters.GPUComputePassDescriptor(descriptor, { @@ -2796,7 +2816,7 @@ destinationOffset, size, ) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'copyBufferToBuffer' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 5, { prefix }); @@ -2864,7 +2884,7 @@ * @param {GPUExtent3D} copySize */ copyBufferToTexture(source, destination, copySize) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'copyBufferToTexture' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 3, { prefix }); @@ -2932,7 +2952,7 @@ * @param {GPUExtent3D} copySize */ copyTextureToBuffer(source, destination, copySize) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'copyTextureToBuffer' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 3, { prefix }); @@ -2999,7 +3019,7 @@ * @param {GPUExtent3D} copySize */ copyTextureToTexture(source, destination, copySize) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'copyTextureToTexture' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 3, { prefix }); @@ -3070,7 +3090,7 @@ * @param {GPUSize64} size */ clearBuffer(destination, destinationOffset, size) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'clearBuffer' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 3, { prefix }); @@ -3111,7 +3131,7 @@ * @param {string} groupLabel */ pushDebugGroup(groupLabel) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'pushDebugGroup' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -3135,7 +3155,7 @@ } popDebugGroup() { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'popDebugGroup' on 'GPUCommandEncoder'"; const device = assertDevice(this, { prefix, context: "this" }); const commandEncoderRid = assertResource(this, { @@ -3155,7 +3175,7 @@ * @param {string} markerLabel */ insertDebugMarker(markerLabel) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'insertDebugMarker' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -3183,7 +3203,7 @@ * @param {number} queryIndex */ writeTimestamp(querySet, queryIndex) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'writeTimestamp' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -3234,7 +3254,7 @@ destination, destinationOffset, ) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'resolveQuerySet' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 5, { prefix }); @@ -3300,7 +3320,7 @@ * @returns {GPUCommandBuffer} */ finish(descriptor = {}) { - webidl.assertBranded(this, GPUCommandEncoder); + webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'finish' on 'GPUCommandEncoder'"; descriptor = webidl.converters.GPUCommandBufferDescriptor(descriptor, { prefix, @@ -3337,6 +3357,7 @@ } } GPUObjectBaseMixin("GPUCommandEncoder", GPUCommandEncoder); + const GPUCommandEncoderPrototype = GPUCommandEncoder.prototype; const _encoder = Symbol("[[encoder]]"); @@ -3383,7 +3404,7 @@ * @param {number} maxDepth */ setViewport(x, y, width, height, minDepth, maxDepth) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setViewport' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 6, { prefix }); @@ -3430,7 +3451,7 @@ * @param {number} height */ setScissorRect(x, y, width, height) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setScissorRect' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 4, { prefix }); @@ -3472,7 +3493,7 @@ * @param {GPUColor} color */ setBlendConstant(color) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setBlendConstant' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -3499,7 +3520,7 @@ * @param {number} reference */ setStencilReference(reference) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setStencilReference' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -3535,7 +3556,7 @@ * @param {number} queryIndex */ beginPipelineStatisticsQuery(querySet, queryIndex) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'beginPipelineStatisticsQuery' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -3573,7 +3594,7 @@ } endPipelineStatisticsQuery() { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'endPipelineStatisticsQuery' on 'GPURenderPassEncoder'"; assertDevice(this[_encoder], { @@ -3595,7 +3616,7 @@ * @param {number} queryIndex */ writeTimestamp(querySet, queryIndex) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'writeTimestamp' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -3636,7 +3657,7 @@ * @param {GPURenderBundle[]} bundles */ executeBundles(bundles) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'executeBundles' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -3670,7 +3691,7 @@ } endPass() { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'endPass' on 'GPURenderPassEncoder'"; const device = assertDevice(this[_encoder], { prefix, @@ -3697,7 +3718,7 @@ dynamicOffsetsDataStart, dynamicOffsetsDataLength, ) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setBindGroup' on 'GPURenderPassEncoder'"; const device = assertDevice(this[_encoder], { @@ -3718,7 +3739,12 @@ resourceContext: "Argument 2", selfContext: "this", }); - if (!(dynamicOffsetsData instanceof Uint32Array)) { + if ( + !(ObjectPrototypeIsPrototypeOf( + Uint32ArrayPrototype, + dynamicOffsetsData, + )) + ) { dynamicOffsetsData = new Uint32Array(dynamicOffsetsData ?? []); dynamicOffsetsDataStart = 0; dynamicOffsetsDataLength = dynamicOffsetsData.length; @@ -3737,7 +3763,7 @@ * @param {string} groupLabel */ pushDebugGroup(groupLabel) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'pushDebugGroup' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -3761,7 +3787,7 @@ } popDebugGroup() { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'popDebugGroup' on 'GPURenderPassEncoder'"; assertDevice(this[_encoder], { @@ -3782,7 +3808,7 @@ * @param {string} markerLabel */ insertDebugMarker(markerLabel) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'insertDebugMarker' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -3809,7 +3835,7 @@ * @param {GPURenderPipeline} pipeline */ setPipeline(pipeline) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setPipeline' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -3848,7 +3874,7 @@ * @param {number} size */ setIndexBuffer(buffer, indexFormat, offset = 0, size) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setIndexBuffer' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -3904,7 +3930,7 @@ * @param {number} size */ setVertexBuffer(slot, buffer, offset = 0, size) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setVertexBuffer' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -3960,7 +3986,7 @@ * @param {number} firstInstance */ draw(vertexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'draw' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); vertexCount = webidl.converters.GPUSize32(vertexCount, { @@ -4011,7 +4037,7 @@ baseVertex = 0, firstInstance = 0, ) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'drawIndexed' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -4059,7 +4085,7 @@ * @param {number} indirectOffset */ drawIndirect(indirectBuffer, indirectOffset) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'drawIndirect' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -4101,7 +4127,7 @@ * @param {number} indirectOffset */ drawIndexedIndirect(indirectBuffer, indirectOffset) { - webidl.assertBranded(this, GPURenderPassEncoder); + webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'drawIndirect' on 'GPURenderPassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -4147,6 +4173,7 @@ } } GPUObjectBaseMixin("GPURenderPassEncoder", GPURenderPassEncoder); + const GPURenderPassEncoderPrototype = GPURenderPassEncoder.prototype; /** * @param {string | null} label @@ -4187,7 +4214,7 @@ * @param {GPUComputePipeline} pipeline */ setPipeline(pipeline) { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'setPipeline' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -4225,7 +4252,7 @@ * @param {number} z */ dispatch(x, y = 1, z = 1) { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'dispatch' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); x = webidl.converters.GPUSize32(x, { prefix, context: "Argument 1" }); @@ -4253,7 +4280,7 @@ * @param {number} indirectOffset */ dispatchIndirect(indirectBuffer, indirectOffset) { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'dispatchIndirect' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -4295,7 +4322,7 @@ * @param {number} queryIndex */ beginPipelineStatisticsQuery(querySet, queryIndex) { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'beginPipelineStatisticsQuery' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -4336,7 +4363,7 @@ } endPipelineStatisticsQuery() { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'endPipelineStatisticsQuery' on 'GPUComputePassEncoder'"; assertDevice(this[_encoder], { @@ -4358,7 +4385,7 @@ * @param {number} queryIndex */ writeTimestamp(querySet, queryIndex) { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'writeTimestamp' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -4396,7 +4423,7 @@ } endPass() { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'endPass' on 'GPUComputePassEncoder'"; const device = assertDevice(this[_encoder], { prefix, @@ -4423,7 +4450,7 @@ dynamicOffsetsDataStart, dynamicOffsetsDataLength, ) { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'setBindGroup' on 'GPUComputePassEncoder'"; const device = assertDevice(this[_encoder], { @@ -4444,7 +4471,12 @@ resourceContext: "Argument 2", selfContext: "this", }); - if (!(dynamicOffsetsData instanceof Uint32Array)) { + if ( + !(ObjectPrototypeIsPrototypeOf( + Uint32ArrayPrototype, + dynamicOffsetsData, + )) + ) { dynamicOffsetsData = new Uint32Array(dynamicOffsetsData ?? []); dynamicOffsetsDataStart = 0; dynamicOffsetsDataLength = dynamicOffsetsData.length; @@ -4463,7 +4495,7 @@ * @param {string} groupLabel */ pushDebugGroup(groupLabel) { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'pushDebugGroup' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -4487,7 +4519,7 @@ } popDebugGroup() { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'popDebugGroup' on 'GPUComputePassEncoder'"; assertDevice(this[_encoder], { @@ -4508,7 +4540,7 @@ * @param {string} markerLabel */ insertDebugMarker(markerLabel) { - webidl.assertBranded(this, GPUComputePassEncoder); + webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'insertDebugMarker' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -4540,6 +4572,7 @@ } } GPUObjectBaseMixin("GPUComputePassEncoder", GPUComputePassEncoder); + const GPUComputePassEncoderPrototype = GPUComputePassEncoder.prototype; /** * @param {string | null} label @@ -4623,7 +4656,7 @@ * @param {GPURenderBundleDescriptor} descriptor */ finish(descriptor = {}) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'finish' on 'GPURenderBundleEncoder'"; descriptor = webidl.converters.GPURenderBundleDescriptor(descriptor, { prefix, @@ -4661,7 +4694,7 @@ dynamicOffsetsDataStart, dynamicOffsetsDataLength, ) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'setBindGroup' on 'GPURenderBundleEncoder'"; const device = assertDevice(this, { prefix, context: "this" }); @@ -4678,7 +4711,12 @@ resourceContext: "Argument 2", selfContext: "this", }); - if (!(dynamicOffsetsData instanceof Uint32Array)) { + if ( + !(ObjectPrototypeIsPrototypeOf( + Uint32ArrayPrototype, + dynamicOffsetsData, + )) + ) { dynamicOffsetsData = new Uint32Array(dynamicOffsetsData ?? []); dynamicOffsetsDataStart = 0; dynamicOffsetsDataLength = dynamicOffsetsData.length; @@ -4697,7 +4735,7 @@ * @param {string} groupLabel */ pushDebugGroup(groupLabel) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'pushDebugGroup' on 'GPURenderBundleEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -4717,7 +4755,7 @@ } popDebugGroup() { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'popDebugGroup' on 'GPURenderBundleEncoder'"; assertDevice(this, { prefix, context: "this" }); @@ -4734,7 +4772,7 @@ * @param {string} markerLabel */ insertDebugMarker(markerLabel) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'insertDebugMarker' on 'GPURenderBundleEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -4757,7 +4795,7 @@ * @param {GPURenderPipeline} pipeline */ setPipeline(pipeline) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'setPipeline' on 'GPURenderBundleEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -4792,7 +4830,7 @@ * @param {number} size */ setIndexBuffer(buffer, indexFormat, offset = 0, size = 0) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'setIndexBuffer' on 'GPURenderBundleEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -4842,7 +4880,7 @@ * @param {number} size */ setVertexBuffer(slot, buffer, offset = 0, size = 0) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'setVertexBuffer' on 'GPURenderBundleEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -4892,7 +4930,7 @@ * @param {number} firstInstance */ draw(vertexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'draw' on 'GPURenderBundleEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); vertexCount = webidl.converters.GPUSize32(vertexCount, { @@ -4939,7 +4977,7 @@ baseVertex = 0, firstInstance = 0, ) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'drawIndexed' on 'GPURenderBundleEncoder'"; webidl.requiredArguments(arguments.length, 1, { prefix }); @@ -4983,7 +5021,7 @@ * @param {number} indirectOffset */ drawIndirect(indirectBuffer, indirectOffset) { - webidl.assertBranded(this, GPURenderBundleEncoder); + webidl.assertBranded(this, GPURenderBundleEncoder.prototype); const prefix = "Failed to execute 'drawIndirect' on 'GPURenderBundleEncoder'"; webidl.requiredArguments(arguments.length, 2, { prefix }); @@ -5114,7 +5152,7 @@ } destroy() { - webidl.assertBranded(this, GPUQuerySet); + webidl.assertBranded(this, GPUQuerySetPrototype); this[_cleanup](); } @@ -5127,6 +5165,7 @@ } } GPUObjectBaseMixin("GPUQuerySet", GPUQuerySet); + const GPUQuerySetPrototype = GPUQuerySet.prototype; window.__bootstrap.webgpu = { gpu: webidl.createBranded(GPU), diff --git a/deno_webgpu/02_idl_types.js b/deno_webgpu/02_idl_types.js index 0dcf849032..dd19f40271 100644 --- a/deno_webgpu/02_idl_types.js +++ b/deno_webgpu/02_idl_types.js @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. // @ts-check /// @@ -56,13 +56,13 @@ // INTERFACE: GPUSupportedLimits webidl.converters.GPUSupportedLimits = webidl.createInterfaceConverter( "GPUSupportedLimits", - GPUSupportedLimits, + GPUSupportedLimits.prototype, ); // INTERFACE: GPUSupportedFeatures webidl.converters.GPUSupportedFeatures = webidl.createInterfaceConverter( "GPUSupportedFeatures", - GPUSupportedFeatures, + GPUSupportedFeatures.prototype, ); // ENUM: GPUPredefinedColorSpace @@ -72,7 +72,7 @@ ); // INTERFACE: GPU - webidl.converters.GPU = webidl.createInterfaceConverter("GPU", GPU); + webidl.converters.GPU = webidl.createInterfaceConverter("GPU", GPU.prototype); // ENUM: GPUPowerPreference webidl.converters["GPUPowerPreference"] = webidl.createEnumConverter( @@ -104,7 +104,7 @@ // INTERFACE: GPUAdapter webidl.converters.GPUAdapter = webidl.createInterfaceConverter( "GPUAdapter", - GPUAdapter, + GPUAdapter.prototype, ); // ENUM: GPUFeatureName @@ -178,13 +178,13 @@ // INTERFACE: GPUDevice webidl.converters.GPUDevice = webidl.createInterfaceConverter( "GPUDevice", - GPUDevice, + GPUDevice.prototype, ); // INTERFACE: GPUBuffer webidl.converters.GPUBuffer = webidl.createInterfaceConverter( "GPUBuffer", - GPUBuffer, + GPUBuffer.prototype, ); // TYPEDEF: GPUSize64 @@ -218,7 +218,7 @@ // INTERFACE: GPUBufferUsage webidl.converters.GPUBufferUsage = webidl.createInterfaceConverter( "GPUBufferUsage", - GPUBufferUsage, + GPUBufferUsage.prototype, ); // TYPEDEF: GPUMapModeFlags @@ -228,13 +228,13 @@ // INTERFACE: GPUMapMode webidl.converters.GPUMapMode = webidl.createInterfaceConverter( "GPUMapMode", - GPUMapMode, + GPUMapMode.prototype, ); // INTERFACE: GPUTexture webidl.converters.GPUTexture = webidl.createInterfaceConverter( "GPUTexture", - GPUTexture, + GPUTexture.prototype, ); // TYPEDEF: GPUIntegerCoordinate @@ -444,13 +444,13 @@ // INTERFACE: GPUTextureUsage webidl.converters.GPUTextureUsage = webidl.createInterfaceConverter( "GPUTextureUsage", - GPUTextureUsage, + GPUTextureUsage.prototype, ); // INTERFACE: GPUTextureView webidl.converters.GPUTextureView = webidl.createInterfaceConverter( "GPUTextureView", - GPUTextureView, + GPUTextureView.prototype, ); // ENUM: GPUTextureViewDimension @@ -517,7 +517,7 @@ // INTERFACE: GPUSampler webidl.converters.GPUSampler = webidl.createInterfaceConverter( "GPUSampler", - GPUSampler, + GPUSampler.prototype, ); // ENUM: GPUAddressMode @@ -613,7 +613,7 @@ // INTERFACE: GPUBindGroupLayout webidl.converters.GPUBindGroupLayout = webidl.createInterfaceConverter( "GPUBindGroupLayout", - GPUBindGroupLayout, + GPUBindGroupLayout.prototype, ); // TYPEDEF: GPUIndex32 @@ -796,13 +796,13 @@ // INTERFACE: GPUShaderStage webidl.converters.GPUShaderStage = webidl.createInterfaceConverter( "GPUShaderStage", - GPUShaderStage, + GPUShaderStage.prototype, ); // INTERFACE: GPUBindGroup webidl.converters.GPUBindGroup = webidl.createInterfaceConverter( "GPUBindGroup", - GPUBindGroup, + GPUBindGroup.prototype, ); // DICTIONARY: GPUBufferBinding @@ -871,7 +871,7 @@ // INTERFACE: GPUPipelineLayout webidl.converters.GPUPipelineLayout = webidl.createInterfaceConverter( "GPUPipelineLayout", - GPUPipelineLayout, + GPUPipelineLayout.prototype, ); // DICTIONARY: GPUPipelineLayoutDescriptor @@ -894,7 +894,7 @@ // INTERFACE: GPUShaderModule webidl.converters.GPUShaderModule = webidl.createInterfaceConverter( "GPUShaderModule", - GPUShaderModule, + GPUShaderModule.prototype, ); // DICTIONARY: GPUShaderModuleDescriptor @@ -926,13 +926,13 @@ // // INTERFACE: GPUCompilationMessage // webidl.converters.GPUCompilationMessage = webidl.createInterfaceConverter( // "GPUCompilationMessage", - // GPUCompilationMessage, + // GPUCompilationMessage.prototype, // ); // // INTERFACE: GPUCompilationInfo // webidl.converters.GPUCompilationInfo = webidl.createInterfaceConverter( // "GPUCompilationInfo", - // GPUCompilationInfo, + // GPUCompilationInfo.prototype, // ); // DICTIONARY: GPUPipelineDescriptorBase @@ -981,7 +981,7 @@ // INTERFACE: GPUComputePipeline webidl.converters.GPUComputePipeline = webidl.createInterfaceConverter( "GPUComputePipeline", - GPUComputePipeline, + GPUComputePipeline.prototype, ); // DICTIONARY: GPUComputePipelineDescriptor @@ -1003,7 +1003,7 @@ // INTERFACE: GPURenderPipeline webidl.converters.GPURenderPipeline = webidl.createInterfaceConverter( "GPURenderPipeline", - GPURenderPipeline, + GPURenderPipeline.prototype, ); // ENUM: GPUVertexStepMode @@ -1476,13 +1476,13 @@ // INTERFACE: GPUColorWrite webidl.converters.GPUColorWrite = webidl.createInterfaceConverter( "GPUColorWrite", - GPUColorWrite, + GPUColorWrite.prototype, ); // INTERFACE: GPUCommandBuffer webidl.converters.GPUCommandBuffer = webidl.createInterfaceConverter( "GPUCommandBuffer", - GPUCommandBuffer, + GPUCommandBuffer.prototype, ); webidl.converters["sequence"] = webidl .createSequenceConverter(webidl.converters["GPUCommandBuffer"]); @@ -1499,7 +1499,7 @@ // INTERFACE: GPUCommandEncoder webidl.converters.GPUCommandEncoder = webidl.createInterfaceConverter( "GPUCommandEncoder", - GPUCommandEncoder, + GPUCommandEncoder.prototype, ); // DICTIONARY: GPUCommandEncoderDescriptor @@ -1654,7 +1654,7 @@ // INTERFACE: GPUComputePassEncoder webidl.converters.GPUComputePassEncoder = webidl.createInterfaceConverter( "GPUComputePassEncoder", - GPUComputePassEncoder, + GPUComputePassEncoder.prototype, ); // DICTIONARY: GPUComputePassDescriptor @@ -1669,7 +1669,7 @@ // INTERFACE: GPURenderPassEncoder webidl.converters.GPURenderPassEncoder = webidl.createInterfaceConverter( "GPURenderPassEncoder", - GPURenderPassEncoder, + GPURenderPassEncoder.prototype, ); // ENUM: GPULoadOp @@ -1787,7 +1787,7 @@ // INTERFACE: GPUQuerySet webidl.converters.GPUQuerySet = webidl.createInterfaceConverter( "GPUQuerySet", - GPUQuerySet, + GPUQuerySet.prototype, ); // DICTIONARY: GPURenderPassDescriptor @@ -1815,7 +1815,7 @@ // INTERFACE: GPURenderBundle webidl.converters.GPURenderBundle = webidl.createInterfaceConverter( "GPURenderBundle", - GPURenderBundle, + GPURenderBundle.prototype, ); webidl.converters["sequence"] = webidl .createSequenceConverter(webidl.converters["GPURenderBundle"]); @@ -1832,7 +1832,7 @@ // INTERFACE: GPURenderBundleEncoder webidl.converters.GPURenderBundleEncoder = webidl.createInterfaceConverter( "GPURenderBundleEncoder", - GPURenderBundleEncoder, + GPURenderBundleEncoder.prototype, ); // DICTIONARY: GPURenderPassLayout @@ -1885,7 +1885,7 @@ // INTERFACE: GPUQueue webidl.converters.GPUQueue = webidl.createInterfaceConverter( "GPUQueue", - GPUQueue, + GPUQueue.prototype, ); // ENUM: GPUQueryType @@ -1945,7 +1945,7 @@ // // INTERFACE: GPUDeviceLostInfo // webidl.converters.GPUDeviceLostInfo = webidl.createInterfaceConverter( // "GPUDeviceLostInfo", - // GPUDeviceLostInfo, + // GPUDeviceLostInfo.prototype, // ); // ENUM: GPUErrorFilter @@ -1960,13 +1960,13 @@ // INTERFACE: GPUOutOfMemoryError webidl.converters.GPUOutOfMemoryError = webidl.createInterfaceConverter( "GPUOutOfMemoryError", - GPUOutOfMemoryError, + GPUOutOfMemoryError.prototype, ); // INTERFACE: GPUValidationError webidl.converters.GPUValidationError = webidl.createInterfaceConverter( "GPUValidationError", - GPUValidationError, + GPUValidationError.prototype, ); // TYPEDEF: GPUError @@ -1975,7 +1975,7 @@ // // INTERFACE: GPUUncapturedErrorEvent // webidl.converters.GPUUncapturedErrorEvent = webidl.createInterfaceConverter( // "GPUUncapturedErrorEvent", - // GPUUncapturedErrorEvent, + // GPUUncapturedErrorEvent.prototype, // ); // DICTIONARY: GPUUncapturedErrorEventInit diff --git a/deno_webgpu/Cargo.toml b/deno_webgpu/Cargo.toml index d982a00d63..53d570a4ae 100644 --- a/deno_webgpu/Cargo.toml +++ b/deno_webgpu/Cargo.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +# Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. [package] name = "deno_webgpu" @@ -11,7 +11,7 @@ repository = "https://github.com/gfx-rs/wgpu" description = "WebGPU implementation for Deno" [dependencies] -deno_core = "0.114.0" +deno_core = "0.117.0" serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.10", features = ["full"] } wgpu-core = { path = "../wgpu-core", features = ["trace", "replay", "serde"] } diff --git a/deno_webgpu/LICENSE.md b/deno_webgpu/LICENSE.md index bbf190721d..cfc3a5226e 100644 --- a/deno_webgpu/LICENSE.md +++ b/deno_webgpu/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright 2018-2021 the Deno authors +Copyright 2018-2022 the Deno authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/deno_webgpu/src/binding.rs b/deno_webgpu/src/binding.rs index 68915c3531..9d287ec4c1 100644 --- a/deno_webgpu/src/binding.rs +++ b/deno_webgpu/src/binding.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::ResourceId; diff --git a/deno_webgpu/src/buffer.rs b/deno_webgpu/src/buffer.rs index e93318b2d8..820668a6ca 100644 --- a/deno_webgpu/src/buffer.rs +++ b/deno_webgpu/src/buffer.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::type_error; use deno_core::error::AnyError; diff --git a/deno_webgpu/src/bundle.rs b/deno_webgpu/src/bundle.rs index 541e328f6c..59206c75ce 100644 --- a/deno_webgpu/src/bundle.rs +++ b/deno_webgpu/src/bundle.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::ResourceId; diff --git a/deno_webgpu/src/command_encoder.rs b/deno_webgpu/src/command_encoder.rs index f6e969381d..164df89baf 100644 --- a/deno_webgpu/src/command_encoder.rs +++ b/deno_webgpu/src/command_encoder.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::ResourceId; diff --git a/deno_webgpu/src/compute_pass.rs b/deno_webgpu/src/compute_pass.rs index cd3b088949..0d3ca55e24 100644 --- a/deno_webgpu/src/compute_pass.rs +++ b/deno_webgpu/src/compute_pass.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::ResourceId; diff --git a/deno_webgpu/src/lib.rs b/deno_webgpu/src/lib.rs index a79462b5e4..ae61338bf8 100644 --- a/deno_webgpu/src/lib.rs +++ b/deno_webgpu/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::include_js_files; diff --git a/deno_webgpu/src/pipeline.rs b/deno_webgpu/src/pipeline.rs index ce5b68db20..a28a21118d 100644 --- a/deno_webgpu/src/pipeline.rs +++ b/deno_webgpu/src/pipeline.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::ResourceId; diff --git a/deno_webgpu/src/queue.rs b/deno_webgpu/src/queue.rs index a3e3d34bdf..aa983fd246 100644 --- a/deno_webgpu/src/queue.rs +++ b/deno_webgpu/src/queue.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use std::num::NonZeroU32; diff --git a/deno_webgpu/src/render_pass.rs b/deno_webgpu/src/render_pass.rs index 83a5ff0d0e..63674dba3a 100644 --- a/deno_webgpu/src/render_pass.rs +++ b/deno_webgpu/src/render_pass.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::type_error; use deno_core::error::AnyError; diff --git a/deno_webgpu/src/sampler.rs b/deno_webgpu/src/sampler.rs index 5e49d14c9b..da3ec99341 100644 --- a/deno_webgpu/src/sampler.rs +++ b/deno_webgpu/src/sampler.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::ResourceId; diff --git a/deno_webgpu/src/shader.rs b/deno_webgpu/src/shader.rs index 55fdf7021e..1ef38c3bc1 100644 --- a/deno_webgpu/src/shader.rs +++ b/deno_webgpu/src/shader.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::ResourceId; diff --git a/deno_webgpu/src/texture.rs b/deno_webgpu/src/texture.rs index a3b2b79c7f..edc6d8ab71 100644 --- a/deno_webgpu/src/texture.rs +++ b/deno_webgpu/src/texture.rs @@ -1,4 +1,4 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. use deno_core::error::AnyError; use deno_core::ResourceId;