From 2899193ceb8da22f3d6e0ad1f83cd9a8825bb03b Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 14 Dec 2020 16:28:26 -0500 Subject: [PATCH 1/2] Queue discovery --- spec/index.bs | 59 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index c586e7fedf..aa309b522d 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -1264,6 +1264,9 @@ interface GPUAdapter { [SameObject] readonly attribute GPUAdapterFeatures features; //readonly attribute GPULimits limits; Don't expose higher limits for now. + readonly attribute unsigned long computeQueueCount; + readonly attribute unsigned long transferQueueCount; + Promise requestDevice(optional GPUDeviceDescriptor descriptor = {}); }; @@ -1279,6 +1282,13 @@ interface GPUAdapter { : features :: Accessor for `this`.{{GPUAdapter/[[adapter]]}}.{{adapter/[[features]]}}. + + : computeQueueCount + :: + Count of the compute queues on the adapter. + : transferQueueCount + :: + Count of the transfer-only queues on the adapter. {{GPUAdapter}} has the following internal slots: @@ -1394,7 +1404,9 @@ interface GPUDevice : EventTarget { readonly attribute FrozenArray features; readonly attribute object limits; - [SameObject] readonly attribute GPUQueue defaultQueue; + [SameObject] readonly attribute GPUQueue queue; + [SameObject] readonly attribute sequence computeQueues; + [SameObject] readonly attribute sequence transferQueues; GPUBuffer createBuffer(GPUBufferDescriptor descriptor); GPUTexture createTexture(GPUTextureDescriptor descriptor); @@ -1435,9 +1447,20 @@ GPUDevice includes GPUObjectBase; A {{GPULimits}} object exposing the limits supported by the device (i.e. the ones with which it was created). - : defaultQueue + : queue :: - The default {{GPUQueue}} for this device. + The default {{GPUQueue}} for this device. It's a general-purpose queue + that can support render passe,s and compute passes, and [=transfers=]. + + : computeQueues + :: + The list of compute-only queues on the device. The {{GPUCommandEncoder}}s + created for these queues can only support compute passes and [=transfers=]; + + : transferQueues + :: + The list of transfer-only queues on the device. The {{GPUCommandEncoder}}s + created for these queues can only support [=transfers=]; {{GPUDevice}} has the following internal slots: @@ -4301,6 +4324,14 @@ dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase { # Command Encoding # {#command-encoding} + + ## GPUCommandEncoder ## {#command-encoder}
+ : kind + :: + The {{GPUQueueKind}} to which the produced {{GPUCommandBuffer}} can be submitted. + : measureExecutionTime :: Enable measurement of the GPU execution time of the entire command buffer. @@ -4456,6 +4497,7 @@ dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { error and stop.
- |this|.{{GPUCommandEncoder/[[state]]}} is {{encoder state/open}}. + - |this|.{{GPUCommandEncoder/[[kind]]}} is {{GPUQueueKind/"general"}}. - |descriptor| meets the [$GPURenderPassDescriptor/GPURenderPassDescriptor Valid Usage$] rules.
@@ -4498,6 +4540,7 @@ dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { error and stop.
- |this|.{{GPUCommandEncoder/[[state]]}} is {{encoder state/open}}. + - |this|.{{GPUCommandEncoder/[[kind]]}} is {{GPUQueueKind/"general"}} or {{GPUQueueKind/"compute"}}.
1. Set |this|.{{GPUCommandEncoder/[[state]]}} to {{encoder state/encoding a compute pass}}. @@ -6708,6 +6751,16 @@ GPUQueue includes GPUObjectBase;
+## Transfer operations ## {#transfer-operations} + +Transfers is a class of operations on a queue that can be done for any {{GPUQueueKind}}: + - {{GPUQueue/writeBuffer()}}. + - {{GPUQueue/writeTexture()}}. + - {{GPUQueue/copyImageBitmapToTexture()}}. + - encoded compute pass via {{GPUCommandEncoder/beginComputePass()}}. + - encoded {{GPUCommandEncoder/copyBufferToBuffer()}}, {{GPUCommandEncoder/copyBufferToTexture()}}, + {{GPUCommandEncoder/copyTextureToBuffer()}}, {{GPUCommandEncoder/copyTextureToTexture()}}. + Queries {#queries} ================ From 75352b5163afa617ecddad7b87b8180b1d383891 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 15 Dec 2020 11:11:05 -0500 Subject: [PATCH 2/2] Review notes by Kai --- spec/index.bs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index aa309b522d..bc2fad5ffd 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -1405,8 +1405,8 @@ interface GPUDevice : EventTarget { readonly attribute object limits; [SameObject] readonly attribute GPUQueue queue; - [SameObject] readonly attribute sequence computeQueues; - [SameObject] readonly attribute sequence transferQueues; + readonly attribute FrozenArray computeQueues; + readonly attribute FrozenArray transferQueues; GPUBuffer createBuffer(GPUBufferDescriptor descriptor); GPUTexture createTexture(GPUTextureDescriptor descriptor); @@ -6757,10 +6757,11 @@ GPUQueue includes GPUObjectBase; - {{GPUQueue/writeBuffer()}}. - {{GPUQueue/writeTexture()}}. - {{GPUQueue/copyImageBitmapToTexture()}}. - - encoded compute pass via {{GPUCommandEncoder/beginComputePass()}}. - encoded {{GPUCommandEncoder/copyBufferToBuffer()}}, {{GPUCommandEncoder/copyBufferToTexture()}}, {{GPUCommandEncoder/copyTextureToBuffer()}}, {{GPUCommandEncoder/copyTextureToTexture()}}. +Issue: double-check if `copyImageBitmapToTexture` can be done on a transfer queue + Queries {#queries} ================