Skip to content

Commit 344bfce

Browse files
committed
Apply Kai's feedback
1 parent 6f7c215 commit 344bfce

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

spec/index.bs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,22 @@ interface GPU {
16371637
<!-- If we add ways to make invalid adapter requests (aside from those
16381638
that violate IDL rules), specify that they reject the promise. -->
16391639
</div>
1640+
1641+
: <dfn>getPreferredCanvasFormat()</dfn>
1642+
::
1643+
Returns an optimal {{GPUTextureFormat}} to use for {{GPUCanvasContext}}s on this system.
1644+
1645+
<div algorithm="GPU.getPreferredCanvasFormat">
1646+
**Called on:** {{GPU}} this.
1647+
1648+
**Returns:** {{GPUTextureFormat}}
1649+
1650+
<div class=content-timeline>
1651+
1. Return an optimal {{GPUTextureFormat}} to use when calling
1652+
{{GPUCanvasContext/configure()}} on a {{GPUCanvasContext}} on this system. Must
1653+
be one of the [=supported context formats=].
1654+
</div>
1655+
</div>
16401656
</dl>
16411657

16421658
{{GPU}} has the following internal slots:
@@ -1791,7 +1807,6 @@ interface GPUAdapter {
17911807
readonly attribute boolean isFallbackAdapter;
17921808

17931809
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
1794-
GPUTextureFormat getPreferredContextFormat();
17951810
};
17961811
</script>
17971812

@@ -1896,23 +1911,6 @@ interface GPUAdapter {
18961911
1. Return |promise|.
18971912

18981913
</div>
1899-
1900-
: <dfn>getPreferredContextFormat()</dfn>
1901-
::
1902-
Returns an optimal {{GPUTextureFormat}} to use for {{GPUCanvasContext}}s with devices
1903-
created from this adapter.
1904-
1905-
<div algorithm="GPUCanvasContext.getPreferredContextFormat">
1906-
**Called on:** {{GPUAdapter}} |this|.
1907-
1908-
**Returns:** {{GPUTextureFormat}}
1909-
1910-
<div class=content-timeline>
1911-
1. Return an optimal {{GPUTextureFormat}} to use when calling
1912-
{{GPUCanvasContext/configure()}} on a {{GPUCanvasContext}} with a {{GPUDevice}}
1913-
created by |this|. Must be one of the [=supported context formats=].
1914-
</div>
1915-
</div>
19161914
</dl>
19171915

19181916
<div class="example">
@@ -9747,11 +9745,11 @@ dictionary GPUCanvasConfiguration {
97479745
format for this context:
97489746
<pre highlight="js">
97499747
const canvas = document.createElement('canvas');
9750-
const context = canvas.getContext('webgpu');
9748+
const context = canvas.getContext('webgpu');
97519749

97529750
context.configure({
97539751
device: gpuDevice,
9754-
format: gpuAdapter.getPreferredContextFormat(),
9752+
format: navigator.gpu.getPreferredCanvasFormat(),
97559753
});
97569754
</pre>
97579755
</div>
@@ -9804,7 +9802,7 @@ must be reconfigured by calling {{GPUCanvasContext/configure()}} again with the
98049802
if (entry.target != canvas) { continue; }
98059803
context.configure({
98069804
device: gpuDevice,
9807-
format: gpuAdapter.getPreferredContextFormat(),
9805+
format: navigator.gpu.getPreferredCanvasFormat(),
98089806
size: {
98099807
// This reports the size of the canvas element in pixels
98109808
width: entry.devicePixelContentBoxSize[0].inlineSize,

0 commit comments

Comments
 (0)